home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / ABUSESRC.ZIP / AbuseSrc / macabuse / src / clisp2.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-20  |  84.6 KB  |  2,828 lines

  1. #include "ant.hpp"
  2. #include "lisp.hpp"
  3. #include "game.hpp"
  4. #include "jrand.hpp"
  5. #include "dev.hpp"
  6. #include "pcxread.hpp"
  7. #include "menu.hpp"
  8. #include "dprint.hpp"
  9. #include "clisp.hpp"
  10. #include "chars.hpp"
  11. #include "lisp_gc.hpp"
  12. #include "cop.hpp"
  13. #include "loadgame.hpp"
  14. #include "nfserver.hpp"
  15. #include "joy.hpp"
  16. #include "demo.hpp"
  17. #include "chat.hpp"
  18. #include "text_gui.hpp"
  19. #include "jdir.hpp"
  20. #include "netcfg.hpp"
  21.  
  22. #ifdef __WATCOMC__
  23. #include <direct.h>
  24. #endif
  25.  
  26. extern uchar major_version;
  27. extern uchar minor_version;
  28. extern int has_joystick;
  29.  
  30. void *l_change_on_pickup,*l_MBULLET_ICON5,*l_MBULLET_ICON20,*l_GRENADE_ICON2,*l_GRENADE_ICON10,*l_ROCKET_ICON2,*l_ROCKET_ICON5,
  31.   *l_FBOMB_ICON1,*l_FBOMB_ICON5,*l_PLASMA_ICON20,*l_PLASMA_ICON50,*l_LSABER_ICON100,*l_DFRIS_ICON4,*l_DFRIS_ICON10,*l_LSABER_ICON50,
  32.   *l_TELEPORTER_SND,*l_gun_tints,*l_ant_tints;
  33.  
  34. // the following are references to lisp symbols
  35. void *l_difficulty,*l_easy,*l_hard,*l_medium,*l_main_menu,*l_extreme,
  36.      *l_logo,*l_state_art,*l_abilities,*l_state_sfx,
  37.      *l_song_list,*l_filename,*l_sfx_directory,*l_max_hp,*l_default_font,
  38.      *l_morph,*l_max_power,*l_default_abilities,*l_default_ai_function,
  39.      *l_tile_files,*l_empty_cache,*l_range,*l_hurt_all,*l_death_handler,
  40.      *l_title_screen,*l_console_font,*l_fields,*l_dist,*l_pushx,*l_pushy,
  41.      *l_object,*l_tile,*l_fire_object,*l_FIRE,*l_cop_dead_parts,*l_restart_player,
  42.      *l_help_screens,*l_player_draw,*l_sneaky_draw,*l_health_image,*l_fly_image,
  43.      *l_sneaky_image,*l_draw_fast,*l_player_tints,*l_save_order,*l_next_song,
  44.      *l_level_load_start,
  45.      *l_level_load_end,        *l_cdc_logo,
  46.      *l_keep_backup,
  47.      *l_switch_to_powerful,
  48.      *l_mouse_can_switch,
  49.      *l_ask_save_slot,
  50.      *l_get_local_input,
  51.      *l_post_render,
  52.      *l_chat_input,
  53.      *l_player_text_color,
  54.      *l_level_loaded,        // called when a new level is loaded
  55.      *l_ammo_snd,
  56.  
  57.          *l_up_key,
  58.          *l_down_key,
  59.          *l_left_key,
  60.          *l_right_key,
  61.      *l_weapon_left_key,
  62.        *l_weapon_right_key,
  63.        *l_special_key;
  64.  
  65. char game_name[50];
  66. void *sensor_ai();
  67.  
  68. // variables for the status bar
  69. void        *l_statbar_ammo_x,*l_statbar_ammo_y,
  70.             *l_statbar_ammo_w,*l_statbar_ammo_h,
  71.         *l_statbar_ammo_bg_color,
  72.  
  73.             *l_statbar_health_x,*l_statbar_health_y,
  74.             *l_statbar_health_w,*l_statbar_health_h,
  75.         *l_statbar_health_bg_color,
  76.  
  77.         *l_statbar_logo_x,*l_statbar_logo_y;
  78. uchar chatting_enabled=0; 
  79.  
  80. extern void scatter_line(int x1, int y1, int x2, int y2, int c, int s);
  81. extern void ascatter_line(int x1, int y1, int x2, int y2, int c1, int c2, int s);
  82. extern void show_end();
  83.  
  84. extern int registered;
  85.  
  86. view *lget_view(void *arg, char *msg)
  87. {
  88.   game_object *o=(game_object *)lpointer_value(arg);
  89.   view *c=o->controller();
  90.   if (!c)
  91.   {
  92.     dprintf("%s : object does not have a view\n",msg);
  93.     lbreak("");
  94.     exit(0);
  95.   }
  96.   return c;
  97. }
  98.  
  99. extern int get_option(char *name);
  100. extern void set_login(char *name);
  101.  
  102.  
  103.  
  104. long cli_1(void *args) { return abs(current_object->x-current_level->attacker(current_object)->x); }
  105. long cli_2(void *args) { return abs(current_object->y-current_level->attacker(current_object)->y); }
  106. long cli_3(void *args)
  107. {
  108.   if (!current_object->controller())
  109.     lbreak("object is not a player, cannot determine keypresses");
  110.   else
  111.     return current_object->controller()->key_down(lnumber_value(CAR(args))); 
  112.   return 0;
  113. }
  114.  
  115. long cli_4(void *args)
  116. { return the_game->key_down(lnumber_value(CAR(args))); }
  117.  
  118. long cli_5(void *args)
  119. { return current_level->attacker(current_object)->state; }
  120.  
  121. long cli_6(void *args)
  122. { return current_object->aitype(); }
  123.  
  124. long cli_7(void *args)
  125. {
  126.   if (!current_object->keep_ai_info())
  127.     current_object->set_aistate(0);
  128.   return current_object->aistate();
  129. }
  130.  
  131. long cli_8(void *args)
  132. {
  133.   int ns=lnumber_value(CAR(args));
  134.   current_object->set_aistate_time(0);      
  135.   current_object->set_aistate(ns); return 1; 
  136. }
  137.  
  138. long cli_9(void *args)
  139. { return jrandom(lnumber_value(CAR(args))); }
  140.  
  141. long cli_10(void *args)
  142. { return current_object->aistate_time(); }
  143.  
  144. long cli_11(void *args)
  145. { return current_object->state; }
  146.  
  147. long cli_12(void *args)
  148. { if (current_level->attacker(current_object)->x>current_object->x) return 1;  else return -1; }
  149.  
  150. long cli_13(void *args)
  151. { return current_object->move(lnumber_value(CAR(args)),lnumber_value(CAR(CDR(args))),
  152.                    lnumber_value(CAR(CDR(CDR(args)))));
  153. }
  154.  
  155. long cli_14(void *args)
  156. { if (current_object->direction>0) return 1; else return -1; }
  157.  
  158. long cli_15(void *args)
  159. { return current_object->otype; }
  160.  
  161. long cli_16(void *args)
  162. { return current_object->next_picture(); }
  163.  
  164. long cli_17(void *args)
  165. { current_object->set_fade_dir(lnumber_value(CAR(args))); return 1; }
  166.  
  167. long cli_18(void *args)
  168.   int cx=lnumber_value(CAR(args));
  169.   args=CDR(args);
  170.   int cy=lnumber_value(CAR(args));
  171.   args=CDR(args);
  172.   int but=lnumber_value(CAR(args));
  173.   return current_object->mover(cx,cy,but);
  174. }
  175.  
  176. long cli_19(void *args)
  177. { current_object->set_fade_count(lnumber_value(CAR(args))); return 1; }
  178.  
  179. long cli_20(void *args)
  180. { return current_object->fade_count(); }
  181.  
  182. long cli_21(void *args)
  183. { return current_object->fade_dir(); }
  184.  
  185. long cli_22(void *args)
  186. {
  187.   long x1,y1,x2,y2,xp1,yp1,xp2,yp2;
  188.   current_level->attacker(current_object)->picture_space(x1,y1,x2,y2);
  189.   current_object->picture_space(xp1,yp1,xp2,yp2);
  190.   if (xp1>x2 || xp2<x1 || yp1>y2 || yp2<y1) return 0;
  191.   else return 1;
  192. }
  193.  
  194. long cli_23(void *args)
  195.   current_object->add_power(lnumber_value(CAR(args))); 
  196.   return 0;
  197. }
  198.  
  199. long cli_24(void *args)
  200. { current_object->add_hp(lnumber_value(CAR(args))); return 0; }
  201.  
  202. long cli_27(void *args)
  203. { current_object->drawer(); return 1; }
  204.  
  205. long cli_28(void *args)
  206. { return (dev & EDIT_MODE); }
  207.  
  208. long cli_29(void *args)
  209. { current_object->draw_above(current_view); return 1; }
  210.  
  211. long cli_30(void *args)
  212. { return current_object->x; } 
  213.  
  214. long cli_31(void *args)
  215. { return current_object->y; }
  216.  
  217. long cli_32(void *args)
  218.   long v=lnumber_value(CAR(args));
  219.   current_object->x=v;
  220.   return 1; 
  221.  
  222. long cli_33(void *args)
  223.   long v=lnumber_value(CAR(args));
  224.   current_object->y=v;
  225.   return 1; 
  226. }
  227.  
  228. long cli_34(void *args)
  229.   return current_level->push_characters(current_object,lnumber_value(CAR(args)),
  230.                         lnumber_value(CAR(CDR(args))));
  231. }
  232.  
  233. long cli_37(void *args)
  234. {
  235.   long s=lnumber_value(CAR(args));
  236.   current_object->set_state((character_state)s); 
  237.   return (s==current_object->state);
  238. }
  239.  
  240. long cli_38(void *args)
  241. { return current_level->attacker(current_object)->x;}
  242.  
  243. long cli_39(void *args)
  244. {  return current_level->attacker(current_object)->y; }
  245.  
  246. long cli_40(void *args)
  247. { current_object->change_aitype(lnumber_value(CAR(args))); return 1; }
  248.  
  249.  
  250. long cli_42(void *args)
  251. { return current_object->xvel(); }
  252.  
  253. long cli_43(void *args)
  254. { return current_object->yvel(); }
  255.  
  256. long cli_44(void *args)
  257. { current_object->set_xvel(lnumber_value(CAR(args))); return 1; }
  258.  
  259. long cli_45(void *args)
  260. { current_object->set_yvel(lnumber_value(CAR(args))); return 1; }
  261.  
  262. long cli_46(void *args)
  263. { if (current_level->attacker(current_object)->x>current_object->x) return -1; 
  264. else return 1;
  265. }
  266.  
  267. long cli_47(void *args)
  268. { return lnumber_value(CAR(args))&BLOCKED_LEFT; }
  269.  
  270. long cli_48(void *args)
  271. { return lnumber_value(CAR(args))&BLOCKED_RIGHT; }
  272.  
  273. long cli_50(void *args)
  274. { dev_cont->add_palette(args); return 1;}
  275.  
  276. long cli_51(void *args)
  277. { write_PCX(screen,pal,lstring_value(CAR(args))); return 1;}
  278.  
  279. long cli_52(void *args)
  280. { the_game->zoom=lnumber_value(CAR(args)); the_game->draw(); return 1;}
  281.  
  282. long cli_55(void *args)
  283. { the_game->show_help(lstring_value(CAR(args)));  return 1; }
  284.  
  285.  
  286. long cli_56(void *args)
  287. { return current_object->direction; }
  288.  
  289. long cli_57(void *args)
  290. { current_object->direction=lnumber_value(CAR(args)); return 1; }
  291.  
  292. long cli_58(void *args)
  293. {
  294.   int x1=lnumber_value(CAR(args));
  295.   if (!current_object->controller())      
  296.   { lbreak("set_freeze_time : object is not a focus\n"); }
  297.   else current_object->controller()->freeze_time=x1; 
  298.   return 1;
  299. }
  300.  
  301. long cli_59(void *args)
  302. { return menu(args,big_font); }
  303.  
  304. long cli_60(void *args)
  305. { event ev; dev_cont->do_command(lstring_value(CAR(args)),ev); return 1; }
  306.  
  307. long cli_61(void *args)
  308. { the_game->set_state(lnumber_value(CAR(args))); return 0; }
  309.  
  310. long cli_62(void *args)
  311. {
  312.   int x1=lnumber_value(CAR(args)); args=CDR(args);
  313.   int y1=lnumber_value(CAR(args)); args=CDR(args);
  314.   int x2=lnumber_value(CAR(args)); args=CDR(args);
  315.   int y2=lnumber_value(CAR(args));
  316.   scene_director.set_text_region(x1,y1,x2,y2);  return 0;
  317. }
  318.  
  319. long cli_63(void *args)
  320. { scene_director.set_frame_speed(lnumber_value(CAR(args)));  return 1; }
  321.  
  322. long cli_64(void *args)
  323. { scene_director.set_scroll_speed(lnumber_value(CAR(args))); return 1; }
  324.  
  325. long cli_65(void *args)
  326. { scene_director.set_pan_speed(lnumber_value(CAR(args))); return 1; }
  327.  
  328. long cli_66(void *args)
  329. { scene_director.scroll_text(lstring_value(CAR(args))); return 1; }
  330.  
  331. long cli_67(void *args)
  332. {
  333.   scene_director.set_pan(lnumber_value(CAR(args)),
  334.       lnumber_value(CAR(CDR(args))),
  335.       lnumber_value(CAR(CDR(CDR(args)))));
  336.   return 1;
  337.  
  338. long cli_68(void *args)
  339. { scene_director.wait(CAR(args)); return 1; }
  340.  
  341.  
  342. long cli_73(void *args)
  343. {
  344.   the_game->set_level(new level(lnumber_value(CAR(args)),
  345.       lnumber_value(CAR(CDR(args))),
  346.       lstring_value(CAR(CDR(CDR(args))))));
  347.   return 1;
  348. }
  349.  
  350. long cli_74(void *args)
  351. {
  352.   if (current_level) delete current_level; 
  353.   current_level=new level(100,100,"new_level");   return 0;
  354.  
  355. long cli_75(void *args)
  356. {
  357.   int amount=lnumber_value(CAR(args)); args=CDR(args);
  358.   game_object *o=((game_object *)lpointer_value(CAR(args))); args=CDR(args);
  359.   int xv=0,yv=0;
  360.   if (args)
  361.   {
  362.     xv=lnumber_value(CAR(args)); args=CDR(args);
  363.     yv=lnumber_value(CAR(args));
  364.   }
  365.   o->do_damage(amount,current_object,current_object->x,current_object->y,xv,yv);
  366.   return 0;
  367. }
  368.  
  369. long cli_76(void *args)
  370. {  return current_object->hp(); }
  371.  
  372. long cli_77(void *args)
  373. {
  374.   game_object *o=(game_object *)lpointer_value(CAR(args));
  375.   if (!o->controller())      
  376.     dprintf("set shift : object is not a focus\n");
  377.   else o->controller()->shift_down=lnumber_value(CAR(CDR(args))); return 1;
  378. }
  379.  
  380. long cli_78(void *args)
  381. {
  382.   game_object *o=(game_object *)lpointer_value(CAR(args));
  383.   if (!o->controller())      
  384.     dprintf("set shift : object is not a focus\n");
  385.   else o->controller()->shift_right=lnumber_value(CAR(CDR(args))); return 1;
  386. }
  387.  
  388. long cli_79(void *args)
  389. { current_object->set_gravity(lnumber_value(CAR(args))); return 1; }
  390.  
  391. long cli_80(void *args)
  392. { return current_object->tick(); }
  393.  
  394. long cli_81(void *args)
  395. { current_object->set_xacel((lnumber_value(CAR(args)))); return 1; }
  396.  
  397. long cli_82(void *args)
  398. { current_object->set_yacel((lnumber_value(CAR(args)))); return 1; }
  399.  
  400.  
  401. long cli_84(void *args)
  402. { set_local_players(lnumber_value(CAR(args))); return 1; }
  403.  
  404. long cli_85(void *args)
  405. { return total_local_players(); }
  406.  
  407. long cli_86(void *args)
  408. { light_detail=lnumber_value(CAR(args)); return 1; }
  409.  
  410. long cli_87(void *args)
  411. { return light_detail; }
  412.  
  413. long cli_88(void *args)
  414. { morph_detail=lnumber_value(CAR(args)); return 1; }
  415.  
  416. long cli_89(void *args)
  417. { return morph_detail; }
  418.  
  419. long cli_90(void *args)
  420. {
  421.   current_object->morph_into(lnumber_value(CAR(args)),NULL,
  422.       lnumber_value(CAR(CDR(args))),
  423.       lnumber_value(CAR(CDR(CDR(args))))); return 1; 
  424. }
  425.  
  426. long cli_91(void *args)
  427. { current_object->add_object((game_object *)lpointer_value(CAR(args))); return 1; }
  428.  
  429. long cli_92(void *args)
  430. {
  431.   long cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
  432.   long cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
  433.   long cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
  434.   long cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
  435.   long c=lnumber_value(CAR(args));
  436.   the_game->game_to_mouse(x1,y1,current_view,cx1,cy1);
  437.   the_game->game_to_mouse(x2,y2,current_view,cx2,cy2);
  438.   screen->line(cx1,cy1,cx2,cy2,c);
  439.   return 1;
  440. }
  441.  
  442. long cli_93(void *args)
  443. { return eh->dark_color(); }
  444.  
  445. long cli_94(void *args)
  446. { return eh->medium_color(); }
  447.  
  448. long cli_95(void *args)
  449. { return eh->bright_color(); }
  450.  
  451. long cli_99(void *args)
  452. { current_object->remove_object((game_object *)lpointer_value(CAR(args))); return 1; }
  453.  
  454. long cli_100(void *args)
  455. { current_object->add_light((light_source *)lpointer_value(CAR(args))); return 1; }
  456.  
  457. long cli_101(void *args)
  458. { current_object->remove_light((light_source *)lpointer_value(CAR(args))); return 1; }
  459.  
  460. long cli_102(void *args)
  461. { return current_object->total_objects(); }
  462.  
  463. long cli_103(void *args)
  464. { return current_object->total_lights(); }
  465.  
  466. long cli_104(void *args)
  467.   light_source *l=(light_source *)lpointer_value(CAR(args));
  468.   long x=lnumber_value(CAR(CDR(args)));
  469.   if (x>=1)
  470.     l->inner_radius=x;
  471.   l->calc_range();
  472.   return 1;
  473. }
  474.  
  475. long cli_105(void *args)
  476.   light_source *l=(light_source *)lpointer_value(CAR(args));
  477.   long x=lnumber_value(CAR(CDR(args)));
  478.   if (x>l->inner_radius)
  479.     l->outer_radius=x;
  480.   l->calc_range();
  481.   return 1;
  482.  
  483. long cli_106(void *args)
  484.   light_source *l=(light_source *)lpointer_value(CAR(args));
  485.   l->x=lnumber_value(CAR(CDR(args)));
  486.   l->calc_range();
  487.   return 1;
  488. }
  489.  
  490. long cli_107(void *args)
  491.   light_source *l=(light_source *)lpointer_value(CAR(args));
  492.   l->y=lnumber_value(CAR(CDR(args)));
  493.   l->calc_range();
  494.   return 1;
  495.  
  496. long cli_108(void *args) 
  497.   light_source *l=(light_source *)lpointer_value(CAR(args));
  498.   l->xshift=lnumber_value(CAR(CDR(args)));
  499.   l->calc_range();
  500.   return 1;
  501. }
  502.  
  503. long cli_109(void *args)
  504.   light_source *l=(light_source *)lpointer_value(CAR(args));
  505.   l->yshift=lnumber_value(CAR(CDR(args)));
  506.   l->calc_range();
  507.   return 1;
  508. }
  509.  
  510. long cli_110(void *args)
  511. { return ((light_source *)lpointer_value(CAR(args)))->inner_radius; }
  512.  
  513. long cli_111(void *args)
  514. { return ((light_source *)lpointer_value(CAR(args)))->outer_radius; }
  515.  
  516. long cli_112(void *args)
  517. { return ((light_source *)lpointer_value(CAR(args)))->x; }
  518.  
  519. long cli_113(void *args)
  520. { return ((light_source *)lpointer_value(CAR(args)))->y; }
  521.  
  522. long cli_114(void *args)
  523. { return ((light_source *)lpointer_value(CAR(args)))->xshift; }
  524.  
  525. long cli_115(void *args)
  526. { return ((light_source *)lpointer_value(CAR(args)))->yshift; }
  527.  
  528. long cli_116(void *args)
  529. { return current_object->xacel(); }
  530.  
  531. long cli_117(void *args)
  532. { return current_object->yacel(); }
  533.  
  534. long cli_118(void *args)
  535. { current_level->remove_light((light_source *)lpointer_value(CAR(args))); return 1; }
  536.  
  537. long cli_119(void *args)
  538. { current_object->set_fx(lnumber_value(CAR(args))); return 1; }
  539.  
  540. long cli_120(void *args)
  541. { current_object->set_fy(lnumber_value(CAR(args))); return 1; }
  542.  
  543. long cli_121(void *args)
  544. { current_object->set_fxvel(lnumber_value(CAR(args))); return 1; }
  545.  
  546. long cli_122(void *args)
  547. { current_object->set_fyvel(lnumber_value(CAR(args))); return 1; }
  548.  
  549. long cli_123(void *args)
  550. { current_object->set_fxacel(lnumber_value(CAR(args))); return 1; }
  551.  
  552. long cli_124(void *args)
  553. { current_object->set_fyacel(lnumber_value(CAR(args))); return 1; }
  554.  
  555. long cli_125(void *args)
  556. { return current_object->picture()->width(); }
  557.  
  558. long cli_126(void *args)
  559. { return current_object->picture()->height(); }
  560.  
  561. long cli_127(void *args)
  562.  { dprintf("trap\n"); return 0; }   // I use this to set gdb break points
  563.  
  564. long cli_128(void *args)
  565. { return current_level->platform_push(current_object,lnumber_value(CAR(args)),
  566.                         lnumber_value(CAR(CDR(args))));
  567.  
  568. long cli_133(void *args) // def_sound
  569. {
  570.   lisp_symbol *sym=NULL;
  571.   if (CDR(args))
  572.   {
  573.     sym=(lisp_symbol *)lcar(args);
  574.     if (item_type(sym)!=L_SYMBOL)
  575.     {
  576.       lbreak("expecting first arg to def-character to be a symbol!\n");
  577.       exit(0);
  578.     }
  579.     args=CDR(args);
  580.   }
  581.  
  582.   int sp=current_space;
  583.   current_space=PERM_SPACE;
  584.   int id=cash.reg(lstring_value(lcar(args)),NULL,SPEC_EXTERN_SFX,1);
  585.   if (sym)
  586.     set_symbol_number(sym,id);    // set the symbol value to sfx id                     
  587.   current_space=sp;
  588.   return id;
  589. }
  590.  
  591. long cli_134(void *args)  // play_sound
  592. {
  593.   void *a=args;
  594.   p_ref r1(a);
  595.   int id=lnumber_value(lcar(a));
  596.   if (id<0) return 0;
  597.   a=CDR(a);
  598.   if (!a)
  599.     cash.sfx(id)->play(127);
  600.   else
  601.   {
  602.     int vol=lnumber_value(lcar(a)); a=CDR(a);
  603.     if (a)
  604.     {
  605.       long x=lnumber_value(lcar(a)); a=CDR(a);
  606.       if (!a)
  607.       {
  608.         lprint(args);
  609.         lbreak("expecting y after x in play_sound\n");
  610.         exit(1);
  611.       }
  612.       long y=lnumber_value(lcar(a));
  613.       the_game->play_sound(id,vol,x,y);
  614.     } else cash.sfx(id)->play(vol);        
  615.   } return 0;
  616. }
  617.  
  618.  
  619. long cli_142(void *args)   
  620. {
  621.   long x=lnumber_value(CAR(args)); args=CDR(args);
  622.   if (x<0 || x>=total_weapons)
  623.   { 
  624.     lbreak("weapon out of range (%d)\n",x);
  625.     exit(0);
  626.   }
  627.   return weapon_types[x];
  628. }
  629.  
  630. long cli_143(void *args)  
  631. {
  632.   long x=lnumber_value(CAR(args)); args=CDR(args);
  633.   long y=lnumber_value(CAR(args)); args=CDR(args);
  634.   long r=lnumber_value(CAR(args)); args=CDR(args);
  635.   long m=lnumber_value(CAR(args)); args=CDR(args);
  636.   game_object *o=(game_object *)lpointer_value(CAR(args)); args=CDR(args);
  637.   long mp=lnumber_value(CAR(args));
  638.   current_level->hurt_radius(x,y,r,m,current_object,o,mp);  return 0;
  639.  
  640. long cli_144(void *args)
  641. {
  642.   view *v=current_object->controller();
  643.   if (!v) dprintf("Can't add weapons for non-players\n");
  644.   else
  645.   {
  646.     long x=lnumber_value(CAR(args)); args=CDR(args);
  647.     long y=lnumber_value(CAR(args)); args=CDR(args);
  648.     if (x<0 || x>=total_weapons)
  649.     { lbreak("weapon out of range (%d)\n",x); exit(0); }
  650.     v->add_ammo(x,y);
  651.   }  return 0;
  652. }
  653.  
  654. long cli_145(void *args)  
  655. {
  656.   view *v=current_object->controller();
  657.   if (!v) return 0;
  658.   else return v->weapon_total(lnumber_value(CAR(args)));
  659. }
  660.  
  661. long cli_146(void *args)    
  662. {
  663.   view *v=current_object->controller();
  664.   if (!v) return 0; else return v->current_weapon;
  665. }
  666.  
  667. long cli_147(void *args)   
  668. {
  669.   view *v=current_object->controller();
  670.   if (!v) { lbreak("current_weapon_type : object cannot hold weapons\n");
  671.   return 0; } 
  672.   else return v->current_weapon;
  673. }
  674.  
  675. long cli_148(void *args)
  676. { return lnumber_value(CAR(args))&BLOCKED_UP; }
  677.  
  678. long cli_149(void *args)
  679. { return lnumber_value(CAR(args))&BLOCKED_DOWN; }
  680.  
  681. long cli_150(void *args)   
  682. {
  683.   view *v=current_object->controller();
  684.   int x=lnumber_value(CAR(args));
  685.   if (x<0 || x>=total_weapons)
  686.   { lbreak("weapon out of range (%d)\n",x); exit(0); }
  687.   if (v) v->give_weapon(x);  return 0;
  688.  
  689. long cli_151(void *args)   
  690. {
  691.   int a=lnumber_value(CAR(args));
  692.   if (a<0 || a>=TOTAL_ABILITIES)
  693.   {
  694.     lprint(args);
  695.     lbreak("bad ability number for get_ability, should be 0..%d, not %d\n",
  696.         TOTAL_ABILITIES,a);
  697.     exit(0);
  698.   }
  699.   return get_ability(current_object->otype,(ability)a);
  700. }
  701.  
  702. long cli_152(void *args)  
  703. {
  704.   view *v=current_object->controller();
  705.   if (!v) dprintf("Can't use reset_player on non-players\n");
  706.   else
  707.     v->reset_player();          
  708.   return 0;
  709. }
  710.  
  711. long cli_153(void *args)   
  712. {
  713.   game_object *o=(game_object *)lpointer_value(CAR(args));
  714.   long x=o->x-current_object->x,
  715.     y=-(o->y-o->picture()->height()/2-(current_object->y-(current_object->picture()->height()/2)));
  716.   return lisp_atan2(y,x);
  717. }
  718.  
  719. long cli_154(void *args)  
  720. {
  721.   long ang=lnumber_value(CAR(args)); args=CDR(args);
  722.   long mag=lfixed_point_value(CAR(args));
  723.   long xvel=(lisp_cos(ang)>>8)*(mag>>8);
  724.   current_object->set_xvel(xvel>>16);
  725.   current_object->set_fxvel((xvel&0xffff)>>8);
  726.   long yvel=-(lisp_sin(ang)>>8)*(mag>>8);
  727.   current_object->set_yvel(yvel>>16);
  728.   current_object->set_fyvel((yvel&0xffff)>>8);    return 0;
  729. }
  730.  
  731. long cli_155(void *args) 
  732. {
  733.   int tframes=current_object->total_frames(),f;
  734.  
  735.   long ang1=lnumber_value(CAR(args)); args=CDR(args);      
  736.   if (ang1<0) ang1=(ang1%360)+360; 
  737.   else if (ang1>=360) ang1=ang1%360;
  738.   long ang2=lnumber_value(CAR(args)); args=CDR(args);      
  739.   if (ang2<0) ang2=(ang2%360)+360; 
  740.   else if (ang2>=360) ang2=ang2%360;
  741.  
  742.   long ang=(lnumber_value(CAR(args))+90/tframes)%360;
  743.   if (ang1>ang2)
  744.   {
  745.     if (ang<ang1 && ang>ang2)     
  746.       return 0;
  747.     else if (ang>=ang1)    
  748.       f=(ang-ang1)*tframes/(359-ang1+ang2+1);
  749.     else 
  750.       f=(359-ang1+ang)*tframes/(359-ang1+ang2+1);
  751.   } else if (ang<ang1 || ang>ang2)
  752.     return 0;
  753.   else f=(ang-ang1)*tframes/(ang2-ang1+1);
  754.   if (current_object->direction>0)
  755.     current_object->current_frame=f;
  756.   else
  757.     current_object->current_frame=tframes-f-1;
  758.   return 1;
  759.  
  760. long cli_156(void *args)
  761. {
  762.   int x=current_object->current_frame;
  763.   current_object->set_state((character_state)lnumber_value(CAR(args)));
  764.   current_object->current_frame=x; return 0;
  765. }
  766.  
  767.  
  768. long cli_168(void *args)
  769. { if (current_object->morph_status()) return 1; else return 0; }
  770.  
  771. long cli_169(void *args)
  772. {
  773.   long am=lnumber_value(CAR(args)); args=CDR(args);
  774.   game_object *from=(game_object *)lpointer_value(CAR(args)); args=CDR(args);
  775.   long hitx=lnumber_value(CAR(args)); args=CDR(args);      
  776.   long hity=lnumber_value(CAR(args)); args=CDR(args);      
  777.   long px=lnumber_value(CAR(args)); args=CDR(args);      
  778.   long py=lnumber_value(CAR(args)); args=CDR(args);
  779.   current_object->damage_fun(am,from,hitx,hity,px,py);
  780.   return 1;
  781. }
  782.  
  783. long cli_170(void *args)
  784. { return current_object->gravity(); }
  785.  
  786. long cli_171(void *args)   
  787. {
  788.   view *v=current_object->controller();
  789.   if (!v) dprintf("make_view_solid : object has no view\n");
  790.   else
  791.     v->draw_solid=lnumber_value(CAR(args));      
  792.   return 1;
  793.  
  794. long cli_172(void *args)
  795. {
  796.   void *a=args;
  797.   int r=lnumber_value(CAR(a)); a=CDR(a);
  798.   int g=lnumber_value(CAR(a)); a=CDR(a);
  799.   int b=lnumber_value(CAR(a));
  800.   if (r<0 || b<0 || g<0 || r>255 || g>255 || b>255)
  801.   {
  802.     lprint(args);
  803.     lbreak("color out of range (0..255) in color lookup\n");
  804.     exit(0);
  805.   }
  806.   return color_table->lookup_color(r>>3,g>>3,b>>3);
  807. }
  808.  
  809. long cli_173(void *args)  
  810. {
  811.   view *v=current_object->controller();
  812.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  813.   else return v->x_suggestion; return 0;
  814. }
  815.  
  816. long cli_174(void *args)  
  817. {
  818.   view *v=current_object->controller();
  819.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  820.   else return v->y_suggestion; return 0;
  821. }
  822.  
  823. long cli_175(void *args)   
  824. {
  825.   view *v=current_object->controller();
  826.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  827.   else return v->b1_suggestion; return 0;
  828. }
  829.  
  830. long cli_176(void *args)  
  831. {
  832.   view *v=current_object->controller();
  833.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  834.   else return v->b2_suggestion; return 0;
  835. }
  836.  
  837. long cli_177(void *args)  
  838. {
  839.   view *v=current_object->controller();
  840.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  841.   else return v->b3_suggestion; return 0;
  842. }
  843.  
  844. long cli_178(void *args)  
  845. {
  846.   bg_xmul=lnumber_value(CAR(args)); args=CDR(args);
  847.   bg_xdiv=lnumber_value(CAR(args)); args=CDR(args);
  848.   bg_ymul=lnumber_value(CAR(args)); args=CDR(args);
  849.   bg_ydiv=lnumber_value(CAR(args)); 
  850.   if (bg_xdiv==0) { bg_xdiv=1; lprint(args); dprintf("bg_set_scroll : cannot set xdiv to 0\n"); }
  851.   if (bg_ydiv==0) { bg_ydiv=1; lprint(args); dprintf("bg_set_scroll : cannot set ydiv to 0\n"); }
  852.   return 1;
  853. }
  854.  
  855. long cli_179(void *args)  
  856. {
  857.   view *v=lget_view(CAR(args),"set_ambient_light");       args=CDR(args);
  858.   long x=lnumber_value(CAR(args));
  859.   if (x>=0 && x<64) v->ambient=x;
  860.   return 1;
  861. }
  862.  
  863. long cli_180(void *args)
  864. { return lget_view(CAR(args),"ambient_light")->ambient; }
  865.  
  866. long cli_181(void *args)
  867. {
  868.   int x=current_object->total_objects();
  869.   game_object *who=(game_object *)lpointer_value(CAR(args));
  870.   for (int i=0;i<x;i++)
  871.     if (current_object->get_object(i)==who) return 1;
  872.   return 0;
  873. }
  874.  
  875. long cli_182(void *args)
  876. {
  877.   current_object->change_type(lnumber_value(CAR(args)));
  878.   return 1;
  879. }
  880.  
  881. long cli_184(void *args)
  882. { return current_object->current_frame; }
  883.  
  884. long cli_185(void *args)
  885. { return current_object->fx(); }
  886.  
  887. long cli_186(void *args)
  888. { return current_object->fy(); }
  889.  
  890. long cli_187(void *args)
  891. { return current_object->fxvel(); }
  892.  
  893. long cli_188(void *args)
  894. { return current_object->fyvel(); }
  895.  
  896. long cli_189(void *args)
  897. { return current_object->fxacel(); }
  898.  
  899. long cli_190(void *args)
  900. { return current_object->fyacel(); }
  901.  
  902.  
  903. long cli_191(void *args) 
  904. {
  905.   char *fn=lstring_value(CAR(args)); args=CDR(args);      
  906. //      stat_bar=cash.reg_object(fn,CAR(args),SPEC_IMAGE,1);
  907.   return 0;
  908.  
  909. long cli_192(void *args)  
  910. {     
  911.   long x=lnumber_value(CAR(args)); args=CDR(args);
  912.   long y=lnumber_value(CAR(args)); args=CDR(args);
  913.   long type=lnumber_value(CAR(args));
  914.   if (x<0 || y<0 || x>=current_level->foreground_width() || y>=current_level->foreground_width())
  915.     lbreak("%d %d is out of range of fg map",x,y);
  916.   else    
  917.     current_level->put_fg(x,y,type);
  918.   return 1;
  919. }
  920.  
  921. long cli_193(void *args) 
  922.   long x=lnumber_value(CAR(args)); args=CDR(args);
  923.   long y=lnumber_value(CAR(args));
  924.   if (x<0 || y<0 || x>=current_level->foreground_width() || y>=current_level->foreground_width())
  925.     lbreak("%d %d is out of range of fg map",x,y);
  926.   else return current_level->get_fg(x,y);
  927.   return 0;
  928. }
  929.  
  930. long cli_194(void *args)  
  931. {     
  932.   long x=lnumber_value(CAR(args)); args=CDR(args);
  933.   long y=lnumber_value(CAR(args)); args=CDR(args);
  934.   long type=lnumber_value(CAR(args));
  935.   if (x<0 || y<0 || x>=current_level->background_width() || y>=current_level->background_width())
  936.     lbreak("%d %d is out of range of fg map",x,y);
  937.   else    
  938.     current_level->put_bg(x,y,type);
  939.   return 1;
  940. }
  941.  
  942. long cli_195(void *args)  
  943.   long x=lnumber_value(CAR(args)); args=CDR(args);
  944.   long y=lnumber_value(CAR(args));
  945.   if (x<0 || y<0 || x>=current_level->background_width() || y>=current_level->background_width())
  946.     lbreak("%d %d is out of range of fg map",x,y);
  947.   else return current_level->get_bg(x,y);
  948.   return 0;
  949. }
  950.  
  951. long cli_196(void *args)
  952. {  load_tiles(args);  return 1 ; }
  953.  
  954. long cli_197(void *args)  
  955. {
  956.   bFILE *fp=open_file(lstring_value(CAR(args)),"rb");
  957.   if (fp->open_failure())
  958.   {
  959.     delete fp;
  960.     lbreak("load_palette : could not open file %s for reading",lstring_value(CAR(args)));
  961.     exit(1);
  962.   } else
  963.   {
  964.     spec_directory sd(fp);
  965.     spec_entry *se=sd.find(SPEC_PALETTE);
  966.     if (!se) lbreak("File %s has no palette!\n",lstring_value(CAR(args)));
  967.     else
  968.     {
  969.       if (pal) delete pal;
  970.       pal=new palette(se,fp);
  971.     }
  972.     delete fp;
  973.   }
  974.   return 0;
  975. }
  976.  
  977. long cli_198(void *args)   
  978. {
  979.   bFILE *fp=open_file(lstring_value(CAR(args)),"rb");
  980.   if (fp->open_failure())
  981.   {
  982.     delete fp;
  983.     lbreak("load_color_filter : could not open file %s for reading",lstring_value(CAR(args)));
  984.     exit(1);
  985.   } else
  986.   {
  987.     spec_directory sd(fp);
  988.     spec_entry *se=sd.find(SPEC_COLOR_TABLE);
  989.     if (!se) lbreak("File %s has no color filter!",lstring_value(CAR(args)));
  990.     else
  991.     {
  992.       if (color_table) delete color_table;
  993.       color_table=new color_filter(se,fp);
  994.     }
  995.     delete fp;
  996.   }
  997.   return 0;
  998. }
  999.  
  1000. long cli_199(void *args) 
  1001. {
  1002.   current_start_type=lnumber_value(CAR(args));
  1003.   set_local_players(1);
  1004.   return 1;
  1005. }
  1006.  
  1007. long cli_200(void *args)
  1008. {
  1009.   long xv=lnumber_value(CAR(args));  args=CDR(args);
  1010.   long yv=lnumber_value(CAR(args));  args=CDR(args);
  1011.   int top=2;
  1012.   if (args)
  1013.     if (!CAR(args)) top=0;
  1014.         
  1015.   long oxv=xv,oyv=yv;
  1016.   current_object->try_move(current_object->x,current_object->y,xv,yv,1|top);
  1017.   current_object->x+=xv;
  1018.   current_object->y+=yv;
  1019.   return (oxv==xv && oyv==yv);
  1020. }
  1021.  
  1022. long cli_201(void *args)
  1023. {
  1024.   long x=lnumber_value(CAR(args));
  1025.   return figures[current_object->otype]->get_sequence((character_state)x)->length();
  1026. }
  1027.  
  1028. long cli_202(void *args)
  1029.   long x1=lnumber_value(CAR(args)); args=CDR(args);
  1030.   long y1=lnumber_value(CAR(args)); args=CDR(args);
  1031.   long x2=lnumber_value(CAR(args)); args=CDR(args);
  1032.   long y2=lnumber_value(CAR(args)); args=CDR(args);
  1033.   void *block_all=CAR(args);
  1034.   long nx2=x2,ny2=y2;
  1035.   if (x2==x1)
  1036.     current_level->vforeground_intersect(x1,y1,y2);
  1037.   else
  1038.     current_level->foreground_intersect(x1,y1,x2,y2);
  1039.   if (x2!=nx2 || y2!=ny2) return 0;
  1040.       
  1041.   if (block_all)
  1042.     current_level->all_boundary_setback(current_object,x1,y1,x2,y2);
  1043.   else
  1044.     current_level->boundary_setback(current_object,x1,y1,x2,y2);
  1045.   return (x2==nx2 && y2==ny2);
  1046.  
  1047. }
  1048.  
  1049. long cli_203(void *args)
  1050. {
  1051.   char *fn=lstring_value(CAR(args)); args=CDR(args);
  1052.   char *name=lstring_value(CAR(args));
  1053.   big_font_pict=cash.reg(fn,name,SPEC_IMAGE,1);     
  1054.   return 1;
  1055. }
  1056.  
  1057. long cli_204(void *args)
  1058. {
  1059.   char *fn=lstring_value(CAR(args)); args=CDR(args);
  1060.   char *name=lstring_value(CAR(args));
  1061.   small_font_pict=cash.reg(fn,name,SPEC_IMAGE,1);     
  1062.   return 1;
  1063. }
  1064.  
  1065. long cli_205(void *args)
  1066. {
  1067.   char *fn=lstring_value(CAR(args)); args=CDR(args);
  1068.   char *name=lstring_value(CAR(args));
  1069.   console_font_pict=cash.reg(fn,name,SPEC_IMAGE,1);     
  1070.   return 1;
  1071. }
  1072.  
  1073. long cli_206(void *args)  
  1074. {
  1075.   long x=lnumber_value(CAR(args));
  1076.   if (x<current_object->total_frames())
  1077.     current_object->current_frame=x;
  1078.   else      
  1079.     lbreak("%d out of range for set_current_frame",x);
  1080.   return 1;
  1081. }
  1082.  
  1083. long cli_208(void *args)     
  1084. {
  1085.   current_object->draw_trans(lnumber_value(CAR(args)),lnumber_value(CAR(CDR(args))));
  1086.   return 1;
  1087. }
  1088.  
  1089. long cli_209(void *args)   
  1090. {
  1091.   current_object->draw_tint(lnumber_value(CAR(args)));
  1092.   return 1;
  1093. }
  1094.  
  1095. long cli_210(void *args)
  1096. {
  1097.   current_object->draw_predator();
  1098.   return 1;
  1099. }
  1100.  
  1101. long cli_211(void *args) 
  1102. { return lget_view(CAR(args),"shift_down")->shift_right; return 1; }
  1103.  
  1104. long cli_212(void *args) 
  1105. { return lget_view(CAR(args),"shift_right")->shift_down; return 1; }
  1106.  
  1107. long cli_213(void *args)
  1108.   view *v=lget_view(CAR(args),"set_no_scroll_range"); args=CDR(args);
  1109.   v->no_xleft=lnumber_value(CAR(args)); args=CDR(args);
  1110.   v->no_ytop=lnumber_value(CAR(args));  args=CDR(args);
  1111.   v->no_xright=lnumber_value(CAR(args)); args=CDR(args);
  1112.   v->no_ybottom=lnumber_value(CAR(args));
  1113.   return 0;
  1114. }
  1115.  
  1116. long cli_215(void *args)   
  1117. {
  1118.   char *fn=lstring_value(CAR(args)); args=CDR(args);
  1119.   char *name=lstring_value(CAR(args)); args=CDR(args);
  1120.   return cash.reg(fn,name,SPEC_IMAGE,1);
  1121. }
  1122.  
  1123. long cli_216(void *args)  
  1124. {
  1125.   long x1=lnumber_value(CAR(args)); args=lcdr(args);
  1126.   long y1=lnumber_value(CAR(args)); args=lcdr(args);
  1127.   long id=lnumber_value(CAR(args));
  1128.   cash.img(id)->put_image(screen,x1,y1,1);
  1129.   return 1;
  1130. }
  1131.  
  1132. long cli_217(void *args)  
  1133. {
  1134.   view *v=current_object->controller();
  1135.   if (!v) lbreak("object has no view : view_x1");
  1136.   else return v->cx1;
  1137.   return 0;
  1138. }
  1139.  
  1140. long cli_218(void *args)  
  1141. {
  1142.   view *v=current_object->controller();
  1143.   if (!v) lbreak("object has no view : view_x1");
  1144.   else return v->cy1;
  1145.   return 0;
  1146. }
  1147.  
  1148.  
  1149. long cli_219(void *args)
  1150. {
  1151.   view *v=current_object->controller();
  1152.   if (!v) lbreak("object has no view : view_x1");
  1153.   else return v->cx2;
  1154.   return 0;
  1155. }
  1156.  
  1157. long cli_220(void *args)   
  1158. {
  1159.   view *v=current_object->controller();
  1160.   if (!v) lbreak("object has no view : view_x1");
  1161.   else return v->cy2;
  1162.   return 0;
  1163. }
  1164.  
  1165. long cli_221(void *args)
  1166. {
  1167.   view *v=current_object->controller();
  1168.   if (!v) lbreak("object has no view : view_push_down");
  1169.   else v->last_y-=lnumber_value(CAR(args));
  1170.   return 1;
  1171. }
  1172.  
  1173. long cli_222(void *args)
  1174. {
  1175.   view *v=current_object->controller();
  1176.   if (!v) lbreak("object has no view : local_player");
  1177.   else return v->local_player();
  1178.   return 0;
  1179. }
  1180.  
  1181. long cli_223(void *args)
  1182. {
  1183.   char *fn=lstring_value(CAR(args));
  1184.   current_level->save(fn,1);
  1185.   return 1;
  1186. }
  1187.  
  1188. long cli_224(void *args)  
  1189. {
  1190.   current_object->set_hp(lnumber_value(CAR(args)));   
  1191.   return 1;
  1192. }
  1193.  
  1194. long cli_225(void *args)  
  1195. {
  1196.   char *fn=lstring_value(CAR(args));
  1197.   the_game->request_level_load(fn);
  1198.   return 1;
  1199. }
  1200.  
  1201. long cli_226(void *args)
  1202. {
  1203.   strcpy(level_file,lstring_value(CAR(args)));
  1204.   return 1;
  1205. }
  1206.  
  1207. long cli_227(void *args)
  1208. {
  1209.   return cash.reg(lstring_value(CAR(args)),"palette",SPEC_PALETTE,1);  
  1210. }
  1211.  
  1212. long cli_228(void *args)  
  1213. {
  1214.   palette *p=pal->copy();
  1215.   uchar *addr=(uchar *)p->addr();
  1216.   int r,g,b;
  1217.   int ra=lnumber_value(CAR(args)); args=CDR(args);
  1218.   int ga=lnumber_value(CAR(args)); args=CDR(args);
  1219.   int ba=lnumber_value(CAR(args));
  1220.   for (int i=0;i<256;i++)
  1221.   {
  1222.     r=(int)*addr+ra; if (r>255) r=255; else if (r<0) r=0; *addr=(uchar)r; addr++;
  1223.     g=(int)*addr+ga; if (g>255) g=255; else if (g<0) g=0; *addr=(uchar)g; addr++;
  1224.     b=(int)*addr+ba; if (b>255) b=255; else if (b<0) b=0; *addr=(uchar)b; addr++;
  1225.   }
  1226.   p->load();
  1227.   delete p;
  1228.   return 0;
  1229. }
  1230.  
  1231. long cli_229(void *args)  
  1232. {
  1233.   view *v=current_object->controller();
  1234.   if (!v) lbreak("object has no view : local_player");
  1235.   else return v->player_number;
  1236.   return 0;
  1237. }
  1238.  
  1239. long cli_230(void *args) 
  1240. {
  1241.   view *v=current_object->controller();
  1242.   if (!v) lbreak("object has no view : local_player");
  1243.   else 
  1244.   {
  1245.     long x=lnumber_value(CAR(args));
  1246.     if (x<0 || x>=total_weapons)
  1247.     { lbreak("weapon out of range (%d)\n",x); exit(0); }
  1248.     v->current_weapon=x;    
  1249.   }
  1250.   return 1;
  1251. }
  1252.  
  1253. long cli_231(void *args)  
  1254. {
  1255.   view *v=current_object->controller();
  1256.   if (!v) lbreak("object has no view : local_player");
  1257.   else return v->has_weapon(lnumber_value(CAR(args)));
  1258.   return 0;
  1259. }
  1260.  
  1261. long cli_232(void *args)
  1262. {
  1263.   ambient_ramp+=lnumber_value(CAR(args));
  1264.   return 1;
  1265. }
  1266.  
  1267. long cli_233(void *args)
  1268. { int x=0; view *v=player_list; for (;v;v=v->next,x++); return x; } 
  1269.  
  1270.  
  1271. long cli_234(void *args)  
  1272. {
  1273.   long cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
  1274.   long cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
  1275.   long cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
  1276.   long cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
  1277.   long c=lnumber_value(CAR(args)); args=lcdr(args);
  1278.   long s=lnumber_value(CAR(args));
  1279.   the_game->game_to_mouse(x1,y1,current_view,cx1,cy1);
  1280.   the_game->game_to_mouse(x2,y2,current_view,cx2,cy2);
  1281.   scatter_line(cx1,cy1,cx2,cy2,c,s);
  1282.   return 1;
  1283.  
  1284. }
  1285.  
  1286. long cli_235(void *args)   
  1287.   if (current_level) return current_level->tick_counter(); 
  1288.   else return 0;
  1289. }
  1290.  
  1291. long cli_236(void *args) 
  1292. {
  1293.   return current_object->controller()!=NULL;
  1294. }
  1295.  
  1296. long cli_237(void *args)  
  1297. {
  1298.   rand_on+=lnumber_value(CAR(args)); return 1;
  1299. }
  1300.  
  1301. long cli_238(void *args)
  1302. {
  1303.   return current_object->total_frames();
  1304. }
  1305.  
  1306. long cli_239(void *args)
  1307.   current_level->to_front(current_object); 
  1308.   return 1;
  1309. }
  1310.  
  1311. long cli_240(void *args) 
  1312.   current_level->to_back(current_object); 
  1313.   return 1;
  1314. }
  1315.  
  1316. long cli_241(void *args)  
  1317.   view *v=current_object->controller();
  1318.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  1319.   else return v->pointer_x;
  1320.   return 0;
  1321.  
  1322. long cli_242(void *args) 
  1323.   view *v=current_object->controller();
  1324.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  1325.   else return v->pointer_y;
  1326.   return 0;
  1327. }
  1328.  
  1329. long cli_243(void *args)
  1330. {
  1331.   if (player_list->next || demo_man.current_state()!=demo_manager::NORMAL)
  1332.     return 0;
  1333.   else
  1334.     return (frame_panic>10);
  1335. }
  1336.  
  1337. long cli_244(void *args)   
  1338. {
  1339.   long cx1,x1=lnumber_value(CAR(args)); args=lcdr(args);
  1340.   long cy1,y1=lnumber_value(CAR(args)); args=lcdr(args);
  1341.   long cx2,x2=lnumber_value(CAR(args)); args=lcdr(args);
  1342.   long cy2,y2=lnumber_value(CAR(args)); args=lcdr(args);
  1343.   long c1=lnumber_value(CAR(args)); args=lcdr(args);
  1344.   long c2=lnumber_value(CAR(args)); args=lcdr(args);
  1345.   long s=lnumber_value(CAR(args));
  1346.   the_game->game_to_mouse(x1,y1,current_view,cx1,cy1);
  1347.   the_game->game_to_mouse(x2,y2,current_view,cx2,cy2);
  1348.   ascatter_line(cx1,cy1,cx2,cy2,c1,c2,s);
  1349.   return 1;
  1350.  
  1351. }
  1352.  
  1353. long cli_245(void *args)
  1354. {
  1355.   return rand_on;
  1356. }
  1357.  
  1358. long cli_246(void *args)  
  1359. {
  1360.   rand_on=lnumber_value(CAR(args));
  1361.   return 1;
  1362. }
  1363.  
  1364. long cli_247(void *args)  
  1365. {
  1366.   long cx1=lnumber_value(CAR(args)); args=lcdr(args);
  1367.   long cy1=lnumber_value(CAR(args)); args=lcdr(args);
  1368.   long cx2=lnumber_value(CAR(args)); args=lcdr(args);
  1369.   long cy2=lnumber_value(CAR(args)); args=lcdr(args);
  1370.   long c1=lnumber_value(CAR(args)); args=lcdr(args);      
  1371.   screen->bar(cx1,cy1,cx2,cy2,c1); 
  1372.   return 1;
  1373. }
  1374.  
  1375. long cli_248(void *args)   
  1376. {
  1377.   return start_argc;
  1378. }
  1379.  
  1380. long cli_249(void *args)  
  1381. {
  1382.   if ((sound_avail&MUSIC_INITIALIZED))
  1383.   {
  1384.     char *fn=lstring_value(CAR(args));
  1385.     if (current_song)
  1386.     {
  1387.       if (current_song->playing())
  1388.         current_song->stop();
  1389.       delete current_song;
  1390.     }
  1391.     current_song=new song(fn);
  1392.     current_song->play(music_volume);
  1393.     dprintf("Playing %s at volume %d\n",fn,music_volume);
  1394.   }
  1395.   return 1;
  1396.  
  1397. long cli_250(void *args)  
  1398. {
  1399.   if (current_song && current_song->playing())
  1400.     current_song->stop();
  1401.   delete current_song;
  1402.   current_song=NULL;
  1403.   return 1;
  1404. }
  1405.  
  1406. long cli_251(void *args)
  1407. { return current_object->targetable(); }
  1408.  
  1409. long cli_252(void *args)
  1410. { current_object->set_targetable( CAR(args)==NULL ? 0 : 1); return 1; }
  1411.  
  1412. long cli_253(void *args)
  1413. { show_stats(); return 1; }
  1414.  
  1415. long cli_254(void *args) 
  1416. {
  1417.   view *v=current_object->controller();
  1418.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  1419.   else return v->kills;
  1420.   return 0;
  1421. }
  1422.  
  1423. long cli_255(void *args) 
  1424. {
  1425.   view *v=current_object->controller();
  1426.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  1427.   else return v->tkills;
  1428.   return 0;
  1429. }
  1430.  
  1431. long cli_256(void *args) 
  1432. {
  1433.   view *v=current_object->controller();
  1434.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  1435.   else return v->secrets;
  1436.   return 0;
  1437. }
  1438.  
  1439. long cli_257(void *args)  
  1440. {
  1441.   view *v=current_object->controller();
  1442.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  1443.   else return v->tsecrets;
  1444.   return 0;
  1445. }
  1446.  
  1447. long cli_258(void *args) 
  1448. {
  1449.   view *v=current_object->controller();
  1450.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  1451.   else v->kills=lnumber_value(CAR(args)); 
  1452.   return 1;
  1453. }
  1454.  
  1455. long cli_259(void *args) 
  1456. {
  1457.   view *v=current_object->controller();
  1458.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  1459.   else v->tkills=lnumber_value(CAR(args)); 
  1460.   return 1;
  1461. }
  1462.  
  1463. long cli_260(void *args) 
  1464. {
  1465.   view *v=current_object->controller();
  1466.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  1467.   else v->secrets=lnumber_value(CAR(args)); 
  1468.   return 1;
  1469. }
  1470.  
  1471. long cli_261(void *args)  
  1472. {
  1473.   view *v=current_object->controller();
  1474.   if (!v) { lprint(args); dprintf("get_player_inputs : object has no view!\n"); }
  1475.   else v->tsecrets=lnumber_value(CAR(args)); 
  1476.   return 1;
  1477.  
  1478. long cli_262(void *args)   
  1479. {
  1480.   the_game->request_end();
  1481.   return 1;
  1482. }
  1483.  
  1484. long cli_263(void *args)    
  1485. {
  1486.   the_game->reset_keymap();
  1487.   return load_game(1,symbol_str("SAVE")); //get_save_spot(); shit
  1488. }
  1489.  
  1490. long cli_264(void *args)  
  1491. {
  1492.   mem_report("mem.rep");
  1493.   return 1;
  1494. }
  1495.  
  1496. long cli_265(void *args)   
  1497. {
  1498.   return major_version;
  1499. }
  1500.  
  1501. long cli_266(void *args)    
  1502. {
  1503.   return minor_version;
  1504. }
  1505.  
  1506. long cli_267(void *args)    
  1507. {
  1508.   current_object->draw_double_tint(lnumber_value(CAR(args)),lnumber_value(CAR(CDR(args))));
  1509.   return 1;
  1510. }
  1511.  
  1512. long cli_268(void *args)   
  1513. {
  1514.   return cash.img(lnumber_value(CAR(args)))->width();
  1515. }
  1516.  
  1517. long cli_269(void *args)   
  1518. {
  1519.   return cash.img(lnumber_value(CAR(args)))->height();
  1520. }
  1521.  
  1522. long cli_270(void *args) 
  1523. {
  1524.   return current_level->foreground_width();
  1525. }
  1526.  
  1527. long cli_271(void *args) 
  1528. {
  1529.   return current_level->foreground_height();
  1530. }
  1531.  
  1532. long cli_272(void *args)  
  1533. {
  1534.   return current_level->background_width();
  1535. }
  1536.  
  1537. long cli_273(void *args) 
  1538. {
  1539.   return current_level->background_height();
  1540. }
  1541.  
  1542. long cli_274(void *args)   
  1543. {
  1544.   return get_keycode(lstring_value(CAR(args)));
  1545. }
  1546.  
  1547. long cli_275(void *args)    
  1548. {
  1549.   int id=lnumber_value(CAR(args));  args=CDR(args);
  1550.   int x=lnumber_value(CAR(args));  args=CDR(args);
  1551.   int y=lnumber_value(CAR(args));
  1552.   c_target=id;
  1553.   if (screen)
  1554.     eh->set_mouse_shape(cash.img(c_target)->copy(),x,y);
  1555.   return 0;
  1556. }
  1557.  
  1558. long cli_276(void *args)   
  1559. {      
  1560.   if (!main_net_cfg) return 0;
  1561.   return become_server(game_name);
  1562. }
  1563.  
  1564. long cli_277(void *args) 
  1565. {
  1566.   JCFont *fnt=(JCFont *)lpointer_value(CAR(args)); args=CDR(args);
  1567.   long x=lnumber_value(CAR(args));       args=CDR(args);
  1568.   long y=lnumber_value(CAR(args));       args=CDR(args);
  1569.   char *st=lstring_value(CAR(args));     args=CDR(args);
  1570.   int color=-1;
  1571.   if (args)
  1572.     color=lnumber_value(CAR(args));
  1573.   fnt->put_string(screen,x,y,st,color);
  1574.   return 0;
  1575. }
  1576.  
  1577. long cli_278(void *args) 
  1578. { return ((JCFont *)lpointer_value(CAR(args)))->width(); }
  1579.  
  1580. long cli_279(void *args) 
  1581. { return ((JCFont *)lpointer_value(CAR(args)))->height(); }
  1582.  
  1583. long cli_280(void *args) 
  1584. { if (chat) chat->put_all(lstring_value(CAR(args))); return 1; }
  1585.  
  1586. long cli_281(void *args)    
  1587. {
  1588.   view *v=current_object->controller();
  1589.   if (!v) { lbreak("get_player_name : object has no view!\n"); }
  1590.   else strcpy(v->name,lstring_value(CAR(args))); 
  1591.   return 1;
  1592. }
  1593.  
  1594. long cli_282(void *args)   
  1595. {
  1596.   long x1=lnumber_value(CAR(args));   args=CDR(args);
  1597.   long y1=lnumber_value(CAR(args));   args=CDR(args);
  1598.   long x2=lnumber_value(CAR(args));   args=CDR(args);
  1599.   long y2=lnumber_value(CAR(args));   args=CDR(args);
  1600.   long c=lnumber_value(CAR(args));
  1601.   screen->bar(x1,y1,x2,y2,c);
  1602.   return 0;
  1603. }
  1604.  
  1605. long cli_283(void *args)   
  1606. {
  1607.   long x1=lnumber_value(CAR(args));   args=CDR(args);
  1608.   long y1=lnumber_value(CAR(args));   args=CDR(args);
  1609.   long x2=lnumber_value(CAR(args));   args=CDR(args);
  1610.   long y2=lnumber_value(CAR(args));   args=CDR(args);
  1611.   long c=lnumber_value(CAR(args));
  1612.   screen->rectangle(x1,y1,x2,y2,c);
  1613.   return 0;
  1614. }
  1615.  
  1616. long cli_284(void *args)   
  1617. {
  1618.   if (get_option(lstring_value(CAR(args))))
  1619.     return 1;
  1620.   else return 0;
  1621. }
  1622.  
  1623. long cli_285(void *args)  
  1624. {
  1625.   char cd[100];
  1626.   getcwd(cd,100);
  1627.   int t=change_dir(lstring_value(CAR(args)));
  1628.   change_dir(cd);
  1629.   return t;
  1630. }
  1631.  
  1632. long cli_286(void *args) 
  1633. {
  1634.   if (change_dir(lstring_value(CAR(args))))
  1635.     return 1;
  1636.   else return 0;      
  1637. }
  1638.  
  1639. long cli_287(void *args) 
  1640. {
  1641.   void *title=CAR(args); args=CDR(args);
  1642.   void *source=CAR(args); args=CDR(args);
  1643.   void *dest=CAR(args); args=CDR(args); 
  1644.  
  1645.   return nice_copy(lstring_value(title),lstring_value(source),lstring_value(dest));      
  1646. }
  1647.  
  1648. long cli_288(void *args) 
  1649. {
  1650.   if (CAR(args)) the_game->set_delay(1); else the_game->set_delay(0);
  1651.   return 1;
  1652. }
  1653.  
  1654. long cli_289(void *args) 
  1655. {
  1656.   set_login(lstring_value(CAR(args)));    
  1657.   return 1;
  1658.  
  1659. long cli_290(void *args) 
  1660. {
  1661.   chatting_enabled=1;
  1662.   return 1;
  1663. }
  1664.  
  1665. long cli_291(void *args) 
  1666. {
  1667.   demo_start=1;
  1668.   return 1;
  1669. }
  1670.  
  1671. long cli_292(void *args)  
  1672. {
  1673.   if (main_net_cfg && main_net_cfg->state==net_configuration::CLIENT)
  1674.     return 1;
  1675.   else return 0;
  1676. }
  1677.  
  1678. long cli_293(void *args)  
  1679. {
  1680.   if (main_net_cfg && (main_net_cfg->state==net_configuration::CLIENT || main_net_cfg->state==net_configuration::SERVER))
  1681.   {
  1682.     view *v=player_list;
  1683.     for (;v;v=v->next)
  1684.       if (v->kills>=main_net_cfg->kills)
  1685.         return 1;
  1686.     
  1687.     
  1688.   }
  1689.   return 0;
  1690. }
  1691.  
  1692. long cli_294(void *args) 
  1693. {
  1694.   view *v=player_list;
  1695.   for (;v;v=v->next)
  1696.   {
  1697.     v->tkills+=v->kills;
  1698.  
  1699.     v->kills=0;
  1700.     game_object *o=current_object;
  1701.     current_object=v->focus;
  1702.  
  1703.     eval_function((lisp_symbol *)l_restart_player,NULL);
  1704.     v->reset_player();
  1705.     v->focus->set_aistate(0);
  1706.     current_object=o;    
  1707.   }
  1708.   return 1;
  1709.  
  1710. long cli_295(void *args) 
  1711. {
  1712.   strncpy(game_name,lstring_value(CAR(args)),sizeof(game_name));
  1713.   game_name[sizeof(game_name)-1]=0;
  1714.   return 1;
  1715. }
  1716.  
  1717. long cli_296(void *args)     
  1718. {
  1719.   if (main_net_cfg)
  1720.     main_net_cfg->min_players=lnumber_value(CAR(args));
  1721.   return 0;
  1722. }
  1723.  
  1724. long cli_297(void *args)  // expire cache item
  1725. {
  1726.   cash.expire(lnumber_value(CAR(args)));
  1727.   return 0;
  1728. }
  1729.  
  1730. #define add_c_function(st,mn,mx,num) add_c_function(st,mn,mx,cli_##num)
  1731. #define add_c_bool_fun(st,mn,mx,num) add_c_bool_fun(st,mn,mx,cli_##num)
  1732.  
  1733.  
  1734. void clisp_init()                            // call by lisp_init, defines symbols and functions
  1735.                                              // to irnterface with c
  1736. {
  1737.   l_easy=make_find_symbol("easy");
  1738.   l_medium=make_find_symbol("medium");
  1739.   l_hard=make_find_symbol("hard");
  1740.   l_extreme=make_find_symbol("extreme");
  1741.  
  1742.   l_logo=make_find_symbol("logo");
  1743.   l_morph=make_find_symbol("morph");
  1744.  
  1745.   l_pushx=make_find_symbol("pushx");
  1746.   l_pushy=make_find_symbol("pushy");
  1747.  
  1748.   l_dist=make_find_symbol("dist");
  1749.   l_state_art=make_find_symbol("state_art");
  1750.   l_abilities=make_find_symbol("abilities");
  1751.   l_default_abilities=make_find_symbol("default_abilities");
  1752.   l_state_sfx=make_find_symbol("state_sfx");
  1753.   l_filename=make_find_symbol("filename");
  1754.   l_sfx_directory=make_find_symbol("sfx_directory");
  1755.   l_default_font=make_find_symbol("default_font");
  1756.   l_console_font=make_find_symbol("console_font");
  1757.   l_default_ai_function=make_find_symbol("default_ai");
  1758.   l_tile_files=make_find_symbol("tile_files");
  1759.   l_empty_cache=make_find_symbol("empty_cache");
  1760.   l_range=make_find_symbol("range");
  1761.   l_difficulty=make_find_symbol("difficulty");
  1762.   l_death_handler=make_find_symbol("death_handler");
  1763.   l_title_screen=make_find_symbol("title_screen");
  1764.   l_fields=make_find_symbol("fields");
  1765.   l_FIRE=make_find_symbol("FIRE");
  1766.   l_fire_object=make_find_symbol("fire_object");
  1767.   l_fire_object=make_find_symbol("fire_object");
  1768.   l_cop_dead_parts=make_find_symbol("cop_dead_parts");
  1769.   l_restart_player=make_find_symbol("restart_player");
  1770.   l_help_screens=make_find_symbol("help_screens");
  1771.   l_save_order=make_find_symbol("save_order");
  1772.   l_next_song=make_find_symbol("next_song");
  1773.   l_player_draw=make_find_symbol("player_draw");
  1774.   l_sneaky_draw=make_find_symbol("sneaky_draw");
  1775.   l_keep_backup=make_find_symbol("keep_backup");
  1776.   l_level_loaded=make_find_symbol("level_loaded");
  1777.  
  1778.   l_draw_fast=make_find_symbol("draw_fast");
  1779.   l_player_tints=make_find_symbol("player_tints");
  1780.   l_ant_tints=make_find_symbol("ant_tints");
  1781.  
  1782.   l_max_hp=make_find_symbol("max_hp");
  1783.   set_symbol_number(l_max_hp,200);
  1784.   l_max_power=make_find_symbol("max_power");
  1785.   l_main_menu=make_find_symbol("main_menu");
  1786.   set_symbol_number(l_max_power,999);
  1787.  
  1788.   set_symbol_number(make_find_symbol("run_state"),RUN_STATE);
  1789.   set_symbol_number(make_find_symbol("pause_state"),PAUSE_STATE);
  1790.   set_symbol_number(make_find_symbol("menu_state"),MENU_STATE);
  1791.   set_symbol_number(make_find_symbol("scene_state"),SCENE_STATE);
  1792.  
  1793.   l_statbar_ammo_x=make_find_symbol("statbar_ammo_x");
  1794.   l_statbar_ammo_y=make_find_symbol("statbar_ammo_y");
  1795.   l_statbar_ammo_w=make_find_symbol("statbar_ammo_w");
  1796.   l_statbar_ammo_h=make_find_symbol("statbar_ammo_h");
  1797.   l_statbar_ammo_bg_color=make_find_symbol("statbar_ammo_bg_color");
  1798.  
  1799.   l_statbar_health_x=make_find_symbol("statbar_health_x");
  1800.   l_statbar_health_y=make_find_symbol("statbar_health_y");
  1801.   l_statbar_health_w=make_find_symbol("statbar_health_w");
  1802.   l_statbar_health_h=make_find_symbol("statbar_health_h");
  1803.   l_statbar_health_bg_color=make_find_symbol("statbar_health_bg_color");
  1804.  
  1805.   l_statbar_logo_x=make_find_symbol("statbar_logo_x");
  1806.   l_statbar_logo_y=make_find_symbol("statbar_logo_y");
  1807.   l_object=make_find_symbol("object");
  1808.   l_tile=make_find_symbol("tile");
  1809.   l_cdc_logo=make_find_symbol("logo");
  1810.  
  1811.   l_switch_to_powerful=make_find_symbol("switch_to_powerful");
  1812.   l_mouse_can_switch=make_find_symbol("mouse_can_switch");
  1813.   l_ask_save_slot=make_find_symbol("ask_save_slot");
  1814.  
  1815.   l_level_load_start=make_find_symbol("level_load_start");
  1816.   l_level_load_end=make_find_symbol("level_load_end");
  1817.   l_get_local_input=make_find_symbol("get_local_input");
  1818.   l_chat_input=make_find_symbol("chat_input");
  1819.   l_player_text_color=make_find_symbol("player_text_color");
  1820.  
  1821.  
  1822.   l_change_on_pickup=make_find_symbol("change_on_pickup");
  1823.   l_MBULLET_ICON5=make_find_symbol("MBULLET_ICON5");
  1824.   l_MBULLET_ICON20=make_find_symbol("MBULLET_ICON20");
  1825.   l_GRENADE_ICON2=make_find_symbol("GRENADE_ICON2");
  1826.   l_GRENADE_ICON10=make_find_symbol("GRENADE_ICON10");
  1827.   
  1828.  
  1829.   l_ROCKET_ICON2=make_find_symbol("ROCKET_ICON2");
  1830.   l_ROCKET_ICON5=make_find_symbol("ROCKET_ICON5");
  1831.  
  1832.  
  1833.   l_FBOMB_ICON1=make_find_symbol("FBOMB_ICON1");
  1834.   l_FBOMB_ICON5=make_find_symbol("FBOMB_ICON5");
  1835.  
  1836.   l_PLASMA_ICON20=make_find_symbol("PLASMA_ICON20");
  1837.   l_PLASMA_ICON50=make_find_symbol("PLASMA_ICON50");
  1838.  
  1839.   l_LSABER_ICON50=make_find_symbol("LSABER_ICON50");
  1840.   l_LSABER_ICON100=make_find_symbol("LSABER_ICON100");
  1841.  
  1842.   l_DFRIS_ICON4=make_find_symbol("DFRIS_ICON4");
  1843.   l_DFRIS_ICON10=make_find_symbol("DFRIS_ICON10");
  1844.  
  1845.   l_TELEPORTER_SND=make_find_symbol("TELEPORTER_SND");
  1846.   l_gun_tints=make_find_symbol("gun_tints");
  1847.  
  1848.  
  1849.   l_ammo_snd=make_find_symbol("AMMO_SND");
  1850.   
  1851.     l_up_key                        =    make_find_symbol("up_key");
  1852.         set_symbol_number(l_up_key,JK_UP);
  1853.  
  1854.     l_down_key                    =    make_find_symbol("down_key");        
  1855.         set_symbol_number(l_down_key,JK_DOWN);
  1856.  
  1857.     l_left_key            =    make_find_symbol("left_key");
  1858.         set_symbol_number(l_left_key,JK_LEFT);
  1859.  
  1860.     l_right_key           =    make_find_symbol("right_key");
  1861.         set_symbol_number(l_right_key,JK_RIGHT);
  1862.  
  1863.     l_weapon_left_key     =    make_find_symbol("weapon_left_key");
  1864.         set_symbol_number(l_weapon_left_key,JK_CTRL_R);
  1865.  
  1866.     l_weapon_right_key    =    make_find_symbol("weapon_right_key");    
  1867.         set_symbol_number(l_weapon_right_key,JK_INSERT);
  1868.  
  1869.     l_special_key         =    make_find_symbol("special_key");
  1870.         set_symbol_number(l_special_key,JK_END);
  1871.  
  1872.  
  1873.   int i;
  1874.   for (i=0;i<MAX_STATE;i++)
  1875.     set_symbol_number(make_find_symbol(state_names[i]),i);
  1876.   for (i=0;i<TOTAL_ABILITIES;i++)
  1877.     set_symbol_number(make_find_symbol(ability_names[i]),i);
  1878.   for (i=0;i<TOTAL_CFLAGS;i++)
  1879.     set_symbol_number(make_find_symbol(cflag_names[i]),i);
  1880.  
  1881.   l_song_list=make_find_symbol("song_list");  
  1882.   l_post_render=make_find_symbol("post_render");
  1883.  
  1884.   add_c_function("distx",0,0,                   1);
  1885.   add_c_function("disty",0,0,                   2);
  1886.   add_c_bool_fun("key_pressed",1,1,             3);
  1887.   add_c_bool_fun("local_key_pressed",1,1,       4);
  1888.  
  1889.   add_c_function("bg_state",0,0,                5);
  1890.   add_c_function("aitype",0,0,                  6);
  1891.   add_c_function("aistate",0,0,                 7);
  1892.   add_c_function("set_aistate",1,1,             8);
  1893.   add_c_function("random",1,1,                  9);
  1894.   add_c_function("state_time",0,0,             10);
  1895.   add_c_function("state",0,0,                  11);
  1896.   add_c_function("toward",0,0,                 12);
  1897.   add_c_function("move",3,3,                   13);
  1898.   add_c_function("facing",0,0,                 14);
  1899.   add_c_function("otype",0,0,                  15);
  1900.   add_c_bool_fun("next_picture",0,0,           16);
  1901.   add_c_bool_fun("set_fade_dir",1,1,           17);
  1902.   add_c_function("mover",3,3,                  18);
  1903.   add_c_bool_fun("set_fade_count",1,1,         19);
  1904.   add_c_function("fade_count",0,0,             20);
  1905.   add_c_function("fade_dir",0,0,               21);
  1906.   add_c_bool_fun("touching_bg",0,0,            22);
  1907.   add_c_function("add_power",1,1,              23);
  1908.   add_c_function("add_hp",1,1,                 24);
  1909.  
  1910.   add_c_bool_fun("draw",0,0,                   27);
  1911.   add_c_bool_fun("edit_mode",0,0,              28);
  1912.   add_c_bool_fun("draw_above",0,0,             29);
  1913.   add_c_function("x",0,0,                      30);
  1914.   add_c_function("y",0,0,                      31);
  1915.   add_c_bool_fun("set_x",1,1,                  32);
  1916.   add_c_bool_fun("set_y",1,1,                  33);  
  1917.   add_c_bool_fun("push_characters",2,2,        34);
  1918.  
  1919.  
  1920.  
  1921.   add_c_bool_fun("set_state",1,1,              37);
  1922.   add_c_function("bg_x",0,0,                   38);
  1923.   add_c_function("bg_y",0,0,                   39);
  1924.   add_c_bool_fun("set_aitype",1,1,             40);
  1925.  
  1926.   add_c_function("xvel",0,0,                   42);
  1927.   add_c_function("yvel",0,0,                   43);
  1928.   add_c_bool_fun("set_xvel",1,1,               44);
  1929.   add_c_bool_fun("set_yvel",1,1,               45);
  1930.   add_c_function("away",0,0,                   46);
  1931.   add_c_bool_fun("blocked_left",1,1,           47);
  1932.   add_c_bool_fun("blocked_right",1,1,          48);
  1933.  
  1934.   add_c_function("add_palette",1,-1,           50);    // name, w,h,x,y,scale, tiles
  1935.   add_c_bool_fun("screen_shot",1,1,            51);    // filename
  1936.  
  1937.   add_c_bool_fun("set_zoom",1,1,               52);
  1938.   add_c_function("show_help",1,1,              55);    // type, x,y
  1939.   add_c_function("direction",0,0,              56);
  1940.   add_c_function("set_direction",1,1,          57);
  1941.  
  1942.   add_c_bool_fun("freeze_player",1,1,          58);   // freeze time
  1943.  
  1944.   add_c_function("menu",1,-1,                  59); 
  1945.   add_c_bool_fun("do_command",1,1,             60);   // command string
  1946.   add_c_bool_fun("set_game_state",1,1,         61);
  1947.   
  1948.  
  1949. // scene control functions, game must first be set to scene mode.
  1950.   add_c_bool_fun("scene:set_text_region",4,4,  62);
  1951.   add_c_bool_fun("scene:set_frame_speed",1,1,  63);
  1952.   add_c_bool_fun("scene:set_scroll_speed",1,1, 64);
  1953.   add_c_bool_fun("scene:set_pan_speed",1,1,    65);
  1954.   add_c_bool_fun("scene:scroll_text",1,1,      66);
  1955.   add_c_bool_fun("scene:pan",3,3,              67);
  1956.   add_c_bool_fun("scene:wait",1,1,             68);
  1957.  
  1958.   add_c_bool_fun("level:new",3,3,              74);    // width, height, name
  1959.  
  1960.   add_c_bool_fun("do_damage",2,4,              75);    // amount, to_object, [pushx pushy]
  1961.   add_c_function("hp",0,0,                     76);
  1962.   add_c_bool_fun("set_shift_down",2,2,         77);
  1963.   add_c_bool_fun("set_shift_right",2,2,        78);
  1964.   add_c_bool_fun("set_gravity",1,1,            79);
  1965.   add_c_function("tick",0,0,                   80);
  1966.  
  1967.   add_c_bool_fun("set_xacel",1,1,              81);
  1968.   add_c_bool_fun("set_yacel",1,1,              82);
  1969.   add_c_bool_fun("set_local_players",1,1,      84);   // set # of players on this machine, unsupported?
  1970.   add_c_function("local_players",0,0,          85);
  1971.  
  1972.   add_c_bool_fun("set_light_detail",1,1,       86);
  1973.   add_c_function("light_detail",0,0,           87);
  1974.   add_c_bool_fun("set_morph_detail",1,1,       88);
  1975.   add_c_function("morph_detail",0,0,           89);
  1976.   add_c_bool_fun("morph_into",3,3,             90);       // type aneal frames
  1977.   add_c_bool_fun("link_object",1,1,            91); 
  1978.  
  1979.   add_c_bool_fun("draw_line",5,5,              92); 
  1980.   add_c_function("dark_color",0,0,             93); 
  1981.   add_c_function("medium_color",0,0,           94); 
  1982.   add_c_function("bright_color",0,0,           95); 
  1983.  
  1984.   add_c_bool_fun("remove_object",1,1,          99); 
  1985.   add_c_bool_fun("link_light",1,1,            100);  
  1986.   add_c_bool_fun("remove_light",1,1,          101); 
  1987.   add_c_function("total_objects",0,0,         102); 
  1988.   add_c_function("total_lights",0,0,          103); 
  1989.  
  1990.   add_c_bool_fun("set_light_r1",2,2,          104);
  1991.   add_c_bool_fun("set_light_r2",2,2,          105);
  1992.   add_c_bool_fun("set_light_x",2,2,           106);
  1993.   add_c_bool_fun("set_light_y",2,2,           107);
  1994.   add_c_bool_fun("set_light_xshift",2,2,      108);
  1995.   add_c_bool_fun("set_light_yshift",2,2,      109);
  1996.  
  1997.   add_c_function("light_r1",1,1,              110);
  1998.   add_c_function("light_r2",1,1,              111);
  1999.   add_c_function("light_x",1,1,               112);
  2000.   add_c_function("light_y",1,1,               113);
  2001.   add_c_function("light_xshift",1,1,          114);
  2002.   add_c_function("light_yshift",1,1,          115);
  2003.  
  2004.   add_c_function("xacel",0,0,                 116);
  2005.   add_c_function("yacel",0,0,                 117);
  2006.   add_c_bool_fun("delete_light",1,1,          118); 
  2007.  
  2008.   add_c_bool_fun("set_fx",1,1,                119);
  2009.   add_c_bool_fun("set_fy",1,1,                120);
  2010.   add_c_bool_fun("set_fxvel",1,1,             121);
  2011.   add_c_bool_fun("set_fyvel",1,1,             122);
  2012.   add_c_bool_fun("set_fxacel",1,1,            123);
  2013.   add_c_bool_fun("set_fyacel",1,1,            124);
  2014.   add_c_function("picture_width",0,0,         125);
  2015.   add_c_function("picture_height",0,0,        126);
  2016.   add_c_bool_fun("trap",0,0,                  127);
  2017.   add_c_bool_fun("platform_push",2,2,         128);
  2018.  
  2019.   add_c_function("def_sound",1,2,             133);  // symbol, filename [ or just filenmae]
  2020.   add_c_bool_fun("play_sound",1,4,            134);
  2021.  
  2022.   add_c_function("weapon_to_type",1,1,        142);  // returns total for type weapon
  2023.   add_c_bool_fun("hurt_radius",6,6,           143);  // x y radius max_damage exclude_object max_push
  2024.  
  2025.   add_c_bool_fun("add_ammo",2,2,              144);  // weapon_type, amount 
  2026.   add_c_function("ammo_total",1,1,            145);  // returns total for type weapon
  2027.   add_c_function("current_weapon",0,0,        146);  // weapon_type, amount
  2028.   add_c_function("current_weapon_type",0,0,   147);  // returns total for type weapon
  2029.  
  2030.   add_c_bool_fun("blocked_up",1,1,            148);
  2031.   add_c_bool_fun("blocked_down",1,1,          149);
  2032.   add_c_bool_fun("give_weapon",1,1,           150);  // type
  2033.   add_c_function("get_ability",1,1,           151);
  2034.   add_c_bool_fun("reset_player",0,0,          152);
  2035.   add_c_function("site_angle",1,1,            153);
  2036.   add_c_bool_fun("set_course",2,2,            154);  // angle, magnitude
  2037.   add_c_bool_fun("set_frame_angle",3,3,       155);  // ang1,ang2, ang
  2038.   add_c_bool_fun("jump_state",1,1,            156);  // don't reset current_frame  
  2039.  
  2040.   add_c_bool_fun("morphing",0,0,              168);
  2041.   add_c_bool_fun("damage_fun",6,6,            169);
  2042.   add_c_bool_fun("gravity",0,0,               170);
  2043.   add_c_bool_fun("make_view_solid",1,1,       171);
  2044.   add_c_function("find_rgb",3,3,              172);
  2045.  
  2046.   add_c_function("player_x_suggest",0,0,      173);  // return player "joystick" x
  2047.   add_c_function("player_y_suggest",0,0,      174);
  2048.   add_c_function("player_b1_suggest",0,0,     175);
  2049.   add_c_function("player_b2_suggest",0,0,     176);
  2050.   add_c_function("player_b3_suggest",0,0,     177);
  2051.  
  2052.   add_c_bool_fun("set_bg_scroll",4,4,         178);  // xmul xdiv ymul ydiv
  2053.   add_c_bool_fun("set_ambient_light",2,2,     179);  // player, 0..63 (out of bounds ignored)
  2054.   add_c_function("ambient_light",1,1,         180);  // player
  2055.   add_c_bool_fun("has_object",1,1,            181);  // true if linked with object x
  2056.   add_c_bool_fun("set_otype",1,1,             182);  // otype
  2057.  
  2058.   add_c_function("current_frame",0,0,         184);  
  2059.   add_c_function("fx",0,0,                    185);
  2060.   add_c_function("fy",0,0,                    186);
  2061.   add_c_function("fxvel",0,0,                 187);
  2062.   add_c_function("fyvel",0,0,                 188);
  2063.   add_c_function("fxacel",0,0,                189);
  2064.   add_c_function("fyacel",0,0,                190);
  2065.   add_c_bool_fun("set_stat_bar",2,2,          191);  // filename, object
  2066.   add_c_bool_fun("set_fg_tile",3,3,           192);  // x,y, tile #
  2067.   add_c_function("fg_tile",2,2,               193);  // x,y
  2068.   add_c_bool_fun("set_bg_tile",3,3,           194);  // x,y, tile #
  2069.   add_c_function("bg_tile",2,2,               195);  // x,y
  2070.   add_c_bool_fun("load_tiles",1,-1,           196);  // filename1, filename2...
  2071.   add_c_bool_fun("load_palette",1,1,          197);  // filename
  2072.   add_c_bool_fun("load_color_filter",1,1,     198);  // filename
  2073.   add_c_bool_fun("create_players",1,1,        199);  // player type, returns true if game is networked
  2074.   add_c_bool_fun("try_move",2,3,              200);  // xv yv (check_top=t) -> returns T if not blocked
  2075.   add_c_function("sequence_length",1,1,       201);  // sequence number
  2076.   add_c_bool_fun("can_see",5,5,               202);  // x1,y1, x2,y2, chars_block
  2077.   add_c_function("load_big_font",2,2,         203);  // filename, name
  2078.   add_c_function("load_small_font",2,2,       204);  // filename, name
  2079.   add_c_function("load_console_font",2,2,     205);  // filename, name
  2080.   add_c_function("set_current_frame",1,1,     206);  
  2081.  
  2082.   add_c_bool_fun("draw_transparent",2,2,      208);  // count, max
  2083.   add_c_bool_fun("draw_tint",1,1,             209);  // tint id number
  2084.   add_c_bool_fun("draw_predator",0,0,         210);  // tint_number
  2085.  
  2086.   add_c_function("shift_down",1,1,            211);  // player
  2087.   add_c_function("shift_right",1,1,           212);  // player
  2088.   add_c_bool_fun("set_no_scroll_range",5,5,   213);  // player, x1,y1,x2,y2
  2089.  
  2090.   add_c_function("def_image",2,2,             215);  // filename,name
  2091.   add_c_bool_fun("put_image",3,3,             216);  // x,y,id
  2092.   add_c_function("view_x1",0,0,               217);
  2093.   add_c_function("view_y1",0,0,               218);
  2094.   add_c_function("view_x2",0,0,               219);
  2095.   add_c_function("view_y2",0,0,               220);
  2096.   add_c_function("view_push_down",1,1,        221);
  2097.   add_c_bool_fun("local_player",0,0,          222);
  2098.   add_c_bool_fun("save_game",1,1,             223);  // filename
  2099.   add_c_bool_fun("set_hp",1,1,                224);
  2100.   add_c_bool_fun("request_level_load",1,1,    225);  // filename
  2101.   add_c_bool_fun("set_first_level",1,1,       226);  // filename
  2102.   add_c_function("def_tint",1,1,              227);  // filename
  2103.   add_c_function("tint_palette",3,3,          228);  // radd,gadd,badd
  2104.   add_c_function("player_number",0,0,         229);  
  2105.   add_c_bool_fun("set_current_weapon",1,1,    230);  // type
  2106.   add_c_bool_fun("has_weapon",1,1,            231);  // type
  2107.   add_c_bool_fun("ambient_ramp",1,1,          232);
  2108.   add_c_function("total_players",0,0,         233);
  2109.   add_c_bool_fun("scatter_line",6,6,          234);  // x1,y1,x2,y2, color, scatter value
  2110.   add_c_function("game_tick",0,0,             235);
  2111.   add_c_bool_fun("isa_player",0,0,            236);
  2112.   add_c_bool_fun("shift_rand_table",1,1,      237);  // amount
  2113.   add_c_function("total_frames",0,0,          238);
  2114.   add_c_function("raise",0,0,                 239);  // call only from reload constructor!
  2115.   add_c_function("lower",0,0,                 240);  // call only from reload constructor!
  2116.  
  2117.   add_c_function("player_pointer_x",0,0,      241);
  2118.   add_c_function("player_pointer_y",0,0,      242);
  2119.   add_c_bool_fun("frame_panic",0,0,           243);
  2120.   add_c_bool_fun("ascatter_line",7,7,         244);  // x1,y1,x2,y2, color1, color2, scatter value
  2121.   add_c_function("rand_on",0,0,               245);
  2122.   add_c_function("set_rand_on",1,1,           246);
  2123.   add_c_function("bar",5,5,                   247);
  2124.   add_c_function("argc",0,0,                  248);
  2125.   add_c_bool_fun("play_song",1,1,             249);  // filename
  2126.   add_c_bool_fun("stop_song",0,0,             250);
  2127.   add_c_bool_fun("targetable",0,0,            251);
  2128.   add_c_bool_fun("set_targetable",1,1,        252);  // T or nil
  2129.   add_c_bool_fun("show_stats",0,0,            253);
  2130.  
  2131.   add_c_function("kills",0,0,                 254);
  2132.   add_c_function("tkills",0,0,                255);
  2133.   add_c_function("secrets",0,0,               256);
  2134.   add_c_function("tsecrets",0,0,              257);
  2135.  
  2136.   add_c_bool_fun("set_kills",1,1,             258);
  2137.   add_c_bool_fun("set_tkills",1,1,            259);
  2138.   add_c_bool_fun("set_secrets",1,1,           260);
  2139.   add_c_bool_fun("set_tsecrets",1,1,          261);
  2140.   add_c_bool_fun("request_end_game",0,0,      262);
  2141.   add_c_function("get_save_slot",0,0,         263);
  2142.   add_c_bool_fun("mem_report",0,0,            264);
  2143.   add_c_function("major_version",0,0,         265);
  2144.   add_c_function("minor_version",0,0,         266);
  2145.   add_c_bool_fun("draw_double_tint",2,2,      267);  // tint1 id number, tint 2 id number
  2146.   add_c_function("image_width",1,1,           268);  // image number
  2147.   add_c_function("image_height",1,1,          269);  // image number
  2148.   add_c_function("foreground_width",0,0,      270);
  2149.   add_c_function("foreground_height",0,0,     271);
  2150.   add_c_function("background_width",0,0,      272);
  2151.   add_c_function("background_height",0,0,     273);
  2152.   add_c_function("get_key_code",1,1,          274);  // name of key, returns code that can be used with keypressed
  2153.   add_c_bool_fun("set_cursor_shape",3,3,      275);  // image id, x hot, y hot
  2154.   add_c_bool_fun("start_server",0,0,          276);
  2155.   add_c_bool_fun("put_string",4,5,            277);  // font,x,y,string, [color]
  2156.   add_c_function("font_width",1,1,            278);  // font
  2157.   add_c_function("font_height",1,1,           279);  // font
  2158.   add_c_bool_fun("chat_print",1,1,            280);  // chat string
  2159.   add_c_bool_fun("set_player_name",1,1,       281);  // name
  2160.   add_c_bool_fun("draw_bar",5,5,              282);  // x1,y1,x2,y2,color
  2161.   add_c_bool_fun("draw_rect",5,5,             283);  // x1,y1,x2,y2,color
  2162.   add_c_bool_fun("get_option",1,1,            284);
  2163.   add_c_bool_fun("dir_exsist",1,1,            285);
  2164.   add_c_bool_fun("chdir",1,1,                 286);
  2165.   add_c_bool_fun("nice_copy",3,3,             287);  // source file, dest file
  2166.   add_c_bool_fun("set_delay_on",1,1,          288);  // T or nil
  2167.   add_c_bool_fun("set_login",1,1,             289);  // name
  2168.   add_c_bool_fun("enable_chatting",0,0,       290);
  2169.   add_c_bool_fun("demo_break_enable",0,0,     291);
  2170.   add_c_bool_fun("am_a_client",0,0,           292);
  2171.   add_c_bool_fun("time_for_next_level",0,0,   293); 
  2172.   add_c_bool_fun("reset_kills",0,0,           294);
  2173.   add_c_bool_fun("set_game_name",1,1,         295);  // name
  2174.   add_c_bool_fun("set_net_min_players",1,1,   296); 
  2175.   add_c_bool_fun("expire_cache_item",1,1,     297);
  2176.  
  2177.   add_lisp_function("go_state",1,1,              0);
  2178.   add_lisp_function("with_object",2,-1,          1);
  2179.   add_lisp_function("bmove",0,1,                 2);   // returns true=unblocked, nil=block, or object
  2180.   add_lisp_function("me",0,0,                    3);
  2181.   add_lisp_function("bg",0,0,                    4);
  2182.   add_lisp_function("find_closest",1,1,          5);
  2183.   add_lisp_function("find_xclosest",1,1,         6); 
  2184.   add_lisp_function("find_xrange",2,2,           7); 
  2185.   add_lisp_function("add_object",3,4,            8);    // type, x,y (type)
  2186.   add_lisp_function("first_focus",0,0,           9);
  2187.   add_lisp_function("next_focus",1,1,           10);
  2188.   add_lisp_function("get_object",1,1,           11);
  2189.   add_lisp_function("get_light",1,1,            12);
  2190.   add_lisp_function("with_objects",1,1,         13);
  2191.   add_lisp_function("add_light",7,7,            14);   // type, x, y, r1, r2, xshift, yshift
  2192.   add_lisp_function("find_enemy",1,1,           15);   // exclude
  2193.   add_lisp_function("user_fun",0,-1,            16);   // calls anobject's user function
  2194.   add_lisp_function("time",2,2,                 17);   // returns a fixed point (times and operation)
  2195.   add_lisp_function("name",0,0,                 18);   // returns current object's name (for debugin)
  2196.   add_lisp_function("float_tick",0,0,           19);
  2197.   add_lisp_function("find_object_in_area",5,5,  20);  // x1, y1, x2, y2  type_list
  2198.   add_lisp_function("find_object_in_angle",3,3, 21);  // start_angle end_angle type_list
  2199.   add_lisp_function("add_object_after",3,4,     22);  // type, x,y (type)
  2200.   add_lisp_function("def_char",2,-1,            23);  // needs at least 2 parms
  2201.   add_lisp_function("see_dist",4,4,             24);  // returns longest unblocked path from x1,y1,x2,y2
  2202.   add_lisp_function("platform",0,0,             25);
  2203.   add_lisp_function("level_name",0,0,           26);
  2204.   add_lisp_function("ant_ai",0,0,               27);
  2205.   add_lisp_function("sensor_ai",0,0,            28);
  2206.   add_lisp_function("dev_draw",0,0,             29);
  2207.   add_lisp_function("top_ai",0,0,               30);
  2208.   add_lisp_function("laser_ufun",2,2,           31);
  2209.   add_lisp_function("top_ufun",2,2,             32);
  2210.  
  2211.   add_lisp_function("player_rocket_ufun",2,2,   34);
  2212.  
  2213.   if (registered)
  2214.   {
  2215.     add_lisp_function("plaser_ufun",2,2,          33);
  2216.     add_lisp_function("lsaber_ufun",2,2,          35);
  2217.   }
  2218.  
  2219.  
  2220.   add_lisp_function("cop_mover",3,3,            36);
  2221.   add_lisp_function("latter_ai",0,0,            37);
  2222.   add_lisp_function("with_obj0",-1,-1,          38);
  2223.   add_lisp_function("activated",0,0,            39);
  2224.   add_lisp_function("top_draw",0,0,             40);
  2225.   add_lisp_function("bottom_draw",0,0,          41);
  2226.   add_lisp_function("mover_ai",0,0,             42);
  2227.   add_lisp_function("sgun_ai",0,0,              43);
  2228.   add_lisp_function("last_savegame_name",0,0,   44);
  2229.   add_lisp_function("next_savegame_name",0,0,   45);
  2230.   add_lisp_function("argv",1,1,                 46);
  2231.   add_lisp_function("joy_stat",0,0,             47);  // xm ym b1 b2 b3
  2232.   add_lisp_function("mouse_stat",0,0,           48);  // mx my b1 b2 b3
  2233.   add_lisp_function("mouse_to_game",2,2,        49);  // pass in x,y -> x,y
  2234.   add_lisp_function("game_to_mouse",2,2,        50);  // pass in x,y -> x,y
  2235.   add_lisp_function("get_main_font",0,0,        51);
  2236.   add_lisp_function("player_name",0,0,          52);
  2237.   add_lisp_function("nice_input",3,3,           53);  // title, prompt, default -> returns input
  2238.   add_lisp_function("get_cwd",0,0,              54);
  2239.   add_lisp_function("system",1,1,               55);
  2240.   add_lisp_function("convert_slashes",2,2,      56);
  2241.   add_lisp_function("show_yes_no",4,4,          57);
  2242.   add_lisp_function("get_directory",1,1,        58);  // path
  2243.   add_lisp_function("nice_menu",3,3,            59);  // title, menu_title, list -> return selection number
  2244.   add_lisp_function("respawn_ai",0,0,           60);
  2245.  
  2246.   add_lisp_function("score_draw",0,0,           61);
  2247.   add_lisp_function("show_kills",0,0,           62); 
  2248.   add_lisp_function("mkptr",1,1,                63);  
  2249.   add_lisp_function("seq",3,3,                  64);
  2250.   add_lisp_function("weapon_icon_ai",0,0,       65); 
  2251.   add_lisp_function("on_draw",0,0,              66);
  2252.   add_lisp_function("tp2_ai",0,0,               67);
  2253.   add_lisp_function("push_char",2,2,            68);
  2254.   add_lisp_function("gun_draw",0,0,             69);
  2255.   add_lisp_function("ant_draw",0,0,             70);
  2256.   add_lisp_function("middle_draw",0,0,          71);
  2257.   add_lisp_function("exp_draw",0,0,             72);
  2258.   add_lisp_function("exp_ai",0,0,               73);
  2259. }
  2260.  
  2261.  
  2262. // Note : args for l_caller have not been evaluated yet!
  2263. void *l_caller(long number, void *args)
  2264. {
  2265.   p_ref r1(args);
  2266.   switch (number)
  2267.   {
  2268.     case 0 : 
  2269.     {
  2270.       current_object->set_aistate(lnumber_value(eval(CAR(args)))); 
  2271.       current_object->set_aistate_time(0);
  2272.       void *ai=figures[current_object->otype]->get_fun(OFUN_AI);
  2273.       if (!ai)
  2274.       {
  2275.     lbreak("hrump... call to go_state, and no ai function defined?\n"
  2276.            "Are you calling from move function (not mover)?\n");
  2277.     exit(0);
  2278.       }
  2279.       return eval_function((lisp_symbol *)ai,NULL);
  2280.     } break;
  2281.     case 1 :
  2282.     {
  2283.       game_object *old_cur=current_object;
  2284.       current_object=(game_object *)lpointer_value(eval(CAR(args))); 
  2285.       void *ret=eval_block(CDR(args));
  2286.       current_object=old_cur;
  2287.       return ret;
  2288.     }  break;
  2289.  
  2290.  
  2291.     case 2 :
  2292.     {
  2293.       int whit;
  2294.       game_object *o;
  2295.       if (args)
  2296.         o=(game_object *)lpointer_value(eval(CAR(args)));
  2297.       else o=current_object;
  2298.       game_object *hit=current_object->bmove(whit,o);
  2299.       if (hit)
  2300.         return new_lisp_pointer(hit);
  2301.       else if (whit) return NULL;
  2302.       else return true_symbol;
  2303.     } break;
  2304.  
  2305.     case 3 : return new_lisp_pointer(current_object); break;
  2306.     case 4 : 
  2307.     { if (player_list->next)
  2308.         return new_lisp_pointer(current_level->attacker(current_object));
  2309.       else return new_lisp_pointer(player_list->focus); } break;
  2310.     case 5 : return new_lisp_pointer(current_level->find_closest(current_object->x,
  2311.                                  current_object->y,
  2312.                                lnumber_value(eval(CAR(args))),
  2313.                                        current_object)); break;
  2314.     case 6 : return new_lisp_pointer(current_level->find_xclosest(current_object->x,
  2315.                                   current_object->y,
  2316.                                   lnumber_value(eval(CAR(args))),
  2317.                                   current_object
  2318.                                   )); break;
  2319.     case 7 : 
  2320.     {
  2321.       long n1=lnumber_value(eval(CAR(args)));
  2322.       long n2=lnumber_value(eval(CAR(CDR(args))));
  2323.       return new_lisp_pointer(current_level->find_xrange(current_object->x,
  2324.                              current_object->y,
  2325.                              n1,
  2326.                              n2
  2327.                              ));
  2328.     } break;
  2329.     case 8 : 
  2330.     {
  2331.       int type=lnumber_value(eval(CAR(args)));          args=CDR(args);
  2332.       long x=lnumber_value(eval(CAR(args)));       args=CDR(args);
  2333.       long y=lnumber_value(eval(CAR(args)));  args=CDR(args);
  2334.       game_object *o;
  2335.       if (args)
  2336.         o=create(type,x,y,0,lnumber_value(eval(CAR(args))));
  2337.       else
  2338.         o=create(type,x,y);
  2339.       if (current_level)
  2340.         current_level->add_object(o);
  2341.       return new_lisp_pointer(o);
  2342.     } break;
  2343.     case 22 : 
  2344.     {
  2345.       int type=lnumber_value(eval(CAR(args)));          args=CDR(args);
  2346.       long x=lnumber_value(eval(CAR(args)));       args=CDR(args);
  2347.       long y=lnumber_value(eval(CAR(args)));  args=CDR(args);
  2348.       game_object *o;
  2349.       if (args)
  2350.         o=create(type,x,y,0,lnumber_value(eval(CAR(args))));
  2351.       else
  2352.         o=create(type,x,y);
  2353.       if (current_level)
  2354.         current_level->add_object_after(o,current_object);
  2355.       return new_lisp_pointer(o);
  2356.     } break;
  2357.  
  2358.     case 9 : return new_lisp_pointer(the_game->first_view->focus); break;
  2359.     case 10 : 
  2360.     {
  2361.       view *v=((game_object *)lpointer_value(eval(CAR(args))))->controller()->next;
  2362.       if (v)
  2363.         return new_lisp_pointer(v->focus);
  2364.       else return NULL;
  2365.     } break;
  2366.     case 11 : 
  2367.     { 
  2368.       return new_lisp_pointer
  2369.       ((void *)current_object->get_object(lnumber_value(eval(CAR(args)))));
  2370.     } break;
  2371.     case 12 : 
  2372.     { 
  2373.       return new_lisp_pointer
  2374.       ((void *)current_object->get_light(lnumber_value(eval(CAR(args)))));
  2375.     } break;
  2376.     case 13 :
  2377.     {
  2378.       game_object *old_cur=current_object;
  2379.       void *ret=NULL;
  2380.       for (int i=0;i<old_cur->total_objects();i++)
  2381.       {    
  2382.     current_object=old_cur->get_object(i);
  2383.     ret=eval(CAR(args));
  2384.       }
  2385.       current_object=old_cur;
  2386.       return ret;
  2387.     } break;
  2388.     case 14 :
  2389.     {
  2390.       int t=lnumber_value(eval(CAR(args))); args=lcdr(args);
  2391.       int x=lnumber_value(eval(CAR(args))); args=lcdr(args);
  2392.       int y=lnumber_value(eval(CAR(args))); args=lcdr(args);
  2393.       int r1=lnumber_value(eval(CAR(args))); args=lcdr(args);
  2394.       int r2=lnumber_value(eval(CAR(args))); args=lcdr(args);
  2395.       int xs=lnumber_value(eval(CAR(args))); args=lcdr(args);
  2396.       int ys=lnumber_value(eval(CAR(args)));
  2397.       return new_lisp_pointer(add_light_source(t,x,y,r1,r2,xs,ys));
  2398.     } break;
  2399.     case 15 :
  2400.     {
  2401. //      return current_lev shit
  2402.     } break;
  2403.     case 16 :
  2404.     {
  2405.       void *f=figures[current_object->otype]->get_fun(OFUN_USER_FUN);
  2406.       if (!f) return NULL;
  2407.       return eval_function((lisp_symbol *)f,args);      
  2408.     } break;
  2409.     case 17 :
  2410.     {
  2411.       long trials=lnumber_value(eval(CAR(args)));
  2412.       args=CDR(args);
  2413.       time_marker start;
  2414.       for (int x=0;x<trials;x++)
  2415.       {
  2416.     clear_tmp();
  2417.     eval(CAR(args));
  2418.       }
  2419.       time_marker end;
  2420.       return new_lisp_fixed_point((long)(end.diff_time(&start)*(1<<16)));
  2421.     } break;
  2422.     case 18 :
  2423.     { return new_lisp_string(object_names[current_object->otype]); } break;
  2424.     case 19 :
  2425.     { return current_object->float_tick(); } break;
  2426.     case 20 :
  2427.     {
  2428.       long x1=lnumber_value(eval(CAR(args))); args=CDR(args);
  2429.       long y1=lnumber_value(eval(CAR(args))); args=CDR(args);
  2430.       long x2=lnumber_value(eval(CAR(args))); args=CDR(args);
  2431.       long y2=lnumber_value(eval(CAR(args))); args=CDR(args);
  2432.  
  2433.       void *list=eval(CAR(args));
  2434.       game_object *find=current_level->find_object_in_area(current_object->x,
  2435.                           current_object->y,
  2436.                           x1,y1,x2,y2,list,current_object);
  2437.       if (find) return new_lisp_pointer(find); 
  2438.       else return NULL;
  2439.     } break;
  2440.  
  2441.     case 21 :
  2442.     {
  2443.       long a1=lnumber_value(eval(CAR(args))); args=CDR(args);
  2444.       long a2=lnumber_value(eval(CAR(args))); args=CDR(args);
  2445.  
  2446.       void *list=eval(CAR(args));
  2447.       p_ref r1(list);
  2448.       game_object *find=current_level->find_object_in_angle(current_object->x,
  2449.                             current_object->y,
  2450.                             a1,a2,list,current_object);
  2451.       if (find) return new_lisp_pointer(find); 
  2452.       else return NULL;
  2453.     } break;
  2454.     case 23 :         // def_character
  2455.     {
  2456.       lisp_symbol *sym=(lisp_symbol *)lcar(args);
  2457.       if (item_type(sym)!=L_SYMBOL)
  2458.       {
  2459.     lbreak("expecting first arg to def-character to be a symbol!\n");
  2460.     exit(0);
  2461.       }
  2462.       int sp=current_space;
  2463.       current_space=PERM_SPACE;
  2464.       set_symbol_number(sym,total_objects);   // set the symbol value to the object number
  2465.       current_space=sp;
  2466.       if (!total_objects)
  2467.       {
  2468.         object_names=(char **)jmalloc(sizeof(char *)*(total_objects+1),"object name list");
  2469.     figures=(character_type **)jmalloc(sizeof(character_type *)*(total_objects+1),"character types");
  2470.       }
  2471.       else
  2472.       {
  2473.         object_names=(char **)jrealloc(object_names,sizeof(char *)*(total_objects+1),
  2474.                        "object name list");
  2475.     figures=(character_type **)jrealloc(figures,sizeof(character_type *)*(total_objects+1),
  2476.                         "character types");
  2477.       }
  2478.  
  2479.       object_names[total_objects]=strcpy(
  2480.       (char *)jmalloc(strlen(lstring_value(symbol_name(sym)))+1,"object name"),
  2481.                      lstring_value(symbol_name(sym)));
  2482.       figures[total_objects]=new character_type(CDR(args),sym);
  2483.       total_objects++;
  2484.       return new_lisp_number(total_objects-1);
  2485.     } break;
  2486.     case 24 :
  2487.     {
  2488.       long x1=lnumber_value(eval(CAR(args)));  args=CDR(args);
  2489.       long y1=lnumber_value(eval(CAR(args)));  args=CDR(args);
  2490.       long x2=lnumber_value(eval(CAR(args)));  args=CDR(args);
  2491.       long y2=lnumber_value(eval(CAR(args)));
  2492.       current_level->foreground_intersect(x1,y1,x2,y2);
  2493.       void *ret=NULL;
  2494.       push_onto_list(new_lisp_number(y2),ret);
  2495.       push_onto_list(new_lisp_number(x2),ret);
  2496.       return ret;
  2497.     } break;
  2498.     case 25 :
  2499.     {
  2500. #ifdef __WATCOMC__
  2501.       return make_find_symbol("WATCOM");
  2502. #endif
  2503. #ifdef __linux__
  2504.       return make_find_symbol("LINUX");
  2505. #endif
  2506.  
  2507. #ifdef __sgi
  2508.       return make_find_symbol("IRIX");
  2509. #endif
  2510.  
  2511. #ifdef __MAC__
  2512.       return make_find_symbol("MAC");
  2513. #endif
  2514.  
  2515.     } break;
  2516.     case 26 :
  2517.     {
  2518.       return new_lisp_string(current_level->name());
  2519.     } break;
  2520.     case 27 : return ant_ai(); break;
  2521.     case 28 : return sensor_ai(); break;
  2522.     case 29 : if (dev&EDIT_MODE) current_object->drawer(); break;
  2523.     case 30 : return top_ai(); break;
  2524.     case 31 : return laser_ufun(args); break;
  2525.     case 32 : return top_ufun(args); break;
  2526.     case 33 : return plaser_ufun(args); break;
  2527.     case 34 : return player_rocket_ufun(args); break;
  2528.     case 35 : return lsaber_ufun(args); break;
  2529.     case 36 :
  2530.     {
  2531.       
  2532.       long xm,ym,but;
  2533.       xm=lnumber_value(CAR(args)); args=CDR(args);
  2534.       ym=lnumber_value(CAR(args)); args=CDR(args);
  2535.       but=lnumber_value(CAR(args));
  2536.       return cop_mover(xm,ym,but);
  2537.     } break;
  2538.     case 37 : return ladder_ai(); break;
  2539.     case 38 :
  2540.     {
  2541.       game_object *old_cur=current_object;
  2542.       current_object=current_object->get_object(0);
  2543.       void *ret=eval_block(args);
  2544.       current_object=old_cur;
  2545.       return ret;
  2546.     }  break;
  2547.     case 39 :
  2548.     {
  2549.       if (current_object->total_objects()==0)
  2550.         return true_symbol;
  2551.       else if (current_object->get_object(0)->aistate())
  2552.         return true_symbol;
  2553.       else return NULL;
  2554.     } break;
  2555.     case 40 : top_draw(); break;
  2556.     case 41 : bottom_draw(); break;
  2557.     case 42 : return mover_ai(); break;
  2558.     case 43 : return sgun_ai();
  2559.     case 44 :
  2560.     {
  2561.       char nm[50];
  2562.       last_savegame_name(nm);
  2563.       return new_lisp_string(nm);
  2564.     } break;
  2565.     case 45 :
  2566.     {
  2567.       char nm[50];
  2568.       sprintf(nm,"save%04d.pcx",load_game(1,symbol_str("LOAD")));
  2569. //      get_savegame_name(nm);
  2570.       the_game->reset_keymap();
  2571.       return new_lisp_string(nm);
  2572.     } break;
  2573.     case 46 :
  2574.     {
  2575.       return new_lisp_string(start_argv[lnumber_value(eval(CAR(args)))]);
  2576.     } break;
  2577.     case 47 :
  2578.     {
  2579.       int xv,yv,b1,b2,b3;
  2580.       if (has_joystick)
  2581.         joy_status(b1,b2,b3,xv,yv);
  2582.       else b1=b2=b3=xv=yv=0;
  2583.  
  2584.       void *ret=NULL;
  2585.       p_ref r1(ret);
  2586.       push_onto_list(new_lisp_number(b3),ret);
  2587.       push_onto_list(new_lisp_number(b2),ret);
  2588.       push_onto_list(new_lisp_number(b1),ret);
  2589.       push_onto_list(new_lisp_number(yv),ret);
  2590.       push_onto_list(new_lisp_number(xv),ret);
  2591.       return ret;
  2592.     } break;
  2593.     case 48 :
  2594.     {
  2595.       void *ret=NULL;
  2596.       {
  2597.     p_ref r1(ret);
  2598.     push_onto_list(new_lisp_number((last_demo_mbut&4)==4),ret);
  2599.     push_onto_list(new_lisp_number((last_demo_mbut&2)==2),ret);
  2600.     push_onto_list(new_lisp_number((last_demo_mbut&1)==1),ret);
  2601.     push_onto_list(new_lisp_number(last_demo_my),ret);
  2602.     push_onto_list(new_lisp_number(last_demo_mx),ret);
  2603.       }
  2604.       return ret;
  2605.     } break;
  2606.     case 49 :
  2607.     {
  2608.       long x=lnumber_value(eval(CAR(args))); args=CDR(args);
  2609.       long y=lnumber_value(eval(CAR(args))); args=CDR(args);
  2610.  
  2611.       long rx,ry;
  2612.       the_game->mouse_to_game(x,y,rx,ry);
  2613.       void *ret=NULL;
  2614.       {
  2615.     p_ref r1(ret);
  2616.     push_onto_list(new_lisp_number(ry),ret);
  2617.     push_onto_list(new_lisp_number(rx),ret);
  2618.       }
  2619.       return ret;
  2620.     } break;
  2621.     case 50 :
  2622.     {
  2623.       long x=lnumber_value(eval(CAR(args))); args=CDR(args);
  2624.       long y=lnumber_value(eval(CAR(args))); args=CDR(args);
  2625.  
  2626.       long rx,ry;
  2627.       the_game->game_to_mouse(x,y,current_view,rx,ry);
  2628.       void *ret=NULL;
  2629.       {
  2630.     p_ref r1(ret);
  2631.     push_onto_list(new_lisp_number(ry),ret);
  2632.     push_onto_list(new_lisp_number(rx),ret);
  2633.       }
  2634.       return ret;
  2635.     } break;
  2636.     case 51 :   return new_lisp_pointer(eh->font()); break;
  2637.     case 52 : 
  2638.     {
  2639.       view *c=current_object->controller();
  2640.       if (!c)
  2641.         lbreak("object is not a player, cannot return name");
  2642.       else
  2643.         return new_lisp_string(c->name);
  2644.     } break;
  2645.     case 53 :
  2646.     {
  2647.       char tit[100],prompt[100],def[100];
  2648.       strcpy(tit,lstring_value(eval(CAR(args))));  args=CDR(args);
  2649.       strcpy(prompt,lstring_value(eval(CAR(args))));  args=CDR(args);
  2650.       strcpy(def,lstring_value(eval(CAR(args))));  args=CDR(args);
  2651.       return nice_input(tit,prompt,def);
  2652.     } break;
  2653.     case 54 :
  2654.     {
  2655.       char cd[150];
  2656.       getcwd(cd,100);
  2657.       return new_lisp_string(cd);
  2658.     } break;
  2659.     case 55 :
  2660.     { system(lstring_value(eval(CAR(args)))); } break;
  2661.     case 56 :
  2662.     {
  2663.       void *fn=eval(CAR(args)); args=CDR(args);
  2664.       char tmp[200];
  2665.       {
  2666.     p_ref r1(fn);
  2667.     char *slash=lstring_value(eval(CAR(args)));
  2668.     char *filename=lstring_value(fn);
  2669.  
  2670.     char *s=filename,*tp;
  2671.     
  2672.     for (tp=tmp;*s;s++,tp++)
  2673.     {
  2674.       if (*s=='/' || *s=='\\') 
  2675.       *tp=*slash;
  2676.       else *tp=*s;
  2677.     }
  2678.     *tp=0;
  2679.       }
  2680.       return new_lisp_string(tmp);
  2681.     } break;
  2682.     case 57 :
  2683.     {
  2684.       return show_yes_no(CAR(args),CAR(CDR(args)),CAR(CDR(CDR(args))),CAR(CDR(CDR(CDR(args)))));
  2685.     } break;
  2686.     case 58 :
  2687.     {
  2688.       char **files,**dirs;
  2689.       int tfiles,tdirs,i;
  2690.  
  2691.       get_directory(lstring_value(eval(CAR(args))),files,tfiles,dirs,tdirs);
  2692.       void *fl=NULL,*dl=NULL,*rl=NULL;
  2693.       {
  2694.     p_ref r1(fl),r2(dl);
  2695.     
  2696.     for (i=tfiles-1;i>=0;i--) { push_onto_list(new_lisp_string(files[i]),fl); jfree(files[i]); }
  2697.     jfree(files);
  2698.  
  2699.     for (i=tdirs-1;i>=0;i--) { push_onto_list(new_lisp_string(dirs[i]),dl); jfree(dirs[i]); }
  2700.     jfree(dirs);
  2701.     
  2702.     push_onto_list(dl,rl);
  2703.     push_onto_list(fl,rl);
  2704.       }
  2705.       
  2706.       return rl;
  2707.     } break;
  2708.     case 59 :
  2709.     {
  2710.       return nice_menu(CAR(args),CAR(CDR(args)),CAR(CDR(CDR(args))));
  2711.     } break;
  2712.     case 60 : return respawn_ai(); break;
  2713.     case 61 : return score_draw();  break;
  2714.     case 62 : return show_kills(); break;
  2715.     case 63 : 
  2716.     {
  2717.         long x;
  2718.         sscanf(lstring_value(eval(CAR(args))),"%x",&x);
  2719.         return new_lisp_pointer((void *)x);
  2720.     } break;
  2721.     case 64 :
  2722.     {
  2723.       char name[256],name2[256];
  2724.       strcpy(name,lstring_value(eval(CAR(args))));  args=CDR(args);
  2725.       long first=lnumber_value(eval(CAR(args)));  args=CDR(args);
  2726.       long last=lnumber_value(eval(CAR(args)));
  2727.       long i;
  2728.       void *ret=NULL;
  2729.       p_ref r1(ret);
  2730.  
  2731.       if (last>=first)
  2732.       {
  2733.         for (i=last;i>=first;i--)
  2734.         {
  2735.           sprintf(name2,"%s%04d.pcx",name,i);
  2736.           push_onto_list(new_lisp_string(name2),ret);
  2737.         }
  2738.       } else
  2739.       {
  2740.         for (i=last;i<=first;i++)
  2741.         {
  2742.           sprintf(name2,"%s%04d.pcx",name,i);
  2743.           push_onto_list(new_lisp_string(name2),ret);
  2744.         }
  2745.       }      
  2746.       return ret;
  2747.     } break;
  2748.     case 65 :
  2749.     { return weapon_icon_ai(); } break;
  2750.     case 66 :
  2751.     { return on_draw(); } break;
  2752.     case 67 :
  2753.     { return tp2_ai(); } break;
  2754.     case 68 :
  2755.     { return push_char(args); } break;
  2756.     case 69 :
  2757.     { return gun_draw(); } break;
  2758.     case 70 :
  2759.     { return ant_draw(); } break;
  2760.     case 71 :
  2761.     { return middle_draw(); } break;
  2762.     case 72 :
  2763.     { return exp_draw(); } break;
  2764.     case 73 :
  2765.     { return exp_ai(); } break;
  2766.   }
  2767.   return NULL;
  2768. }
  2769.  
  2770. //extern bFILE *rcheck,*rcheck_lp;
  2771.  
  2772.  
  2773. int get_lprop_number(void *symbol, int def)  // returns def if symbol undefined or not number type
  2774. {
  2775.   void *v=symbol_value(symbol);
  2776.   if (v)
  2777.   {
  2778.     switch (item_type(v))
  2779.     {
  2780.       case L_FIXED_POINT :
  2781.       case L_NUMBER : 
  2782.       { return lnumber_value(v); } break; 
  2783.       default : return def;              
  2784.     }
  2785.   } else return def;
  2786. }
  2787.  
  2788.  
  2789.  
  2790.  
  2791.  
  2792.